((a * b) + (c * d)) / (b + d)

where

a is the quality of resource 1

b is the quantity of resource 1

c is the quality of resource 2, and

d is the quantity of resource 2.

so for instance if I have 7 each of Ronynium(412) and Ronynium(291), the formula would be

((291 * 7) + (412 * 7)) / (7 + 7) = 351.5

which rounds up to 352.