# Tip the Scales

Given a balance scale, and a set of 4 weights, weighing 1, 3, 9, and 27 grams respectively, one can accurately measure the weight of any unknown object of weight 1, 2, 3, ... 38, 39, or 40 grams. For example, to identify an object X as being 5 grams in weight, one could simply place:

• 1, 3, and X on the left
• 9 on the right

If and only if the scale balances, X weighs 5 grams. More importantly, for any X with weight 1 to 40, there exists exactly one unique configuration of weights that measures X (if we force X to be on the left).

Suppose we always put X on the left. What, then, is the sum of the weights on the right, across all 40 unique configurations?

An explicit example: If we only count unknown weights 1 to 4, we get the following 4 configurations:

• X <-> 1
• X + 1 <-> 3
• X <-> 3
• X <-> 3 + 1

The sum of the weights on the right across all 4 configurations is 11:

$$(1) + (3) + (3) + (3 + 1) = 1 + 3 + 3 + 4 = 11$$

×