#MTH000000026. Ba gia đình (Three Families)

Ba gia đình (Three Families)

Three Families

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Families A, B and C share a garden. Last week family C was away, so A and B did all the work. Family A worked for xx hours and family B worked for yy hours. Both families work at the same speed.

When C returns, it pays a total of zz dollars to A and B to compensate for the work that C should have done. The money must be split according to the work each family did beyond its fair one-third share, not merely in proportion to the hours A and B worked.

Compute the amount received by family A. The input guarantees that both A and B receive nonnegative integer amounts.

Input

One line contains three integers xx, yy, zz.

Output

Print the number of dollars received by family A.

Subtasks

  • Subtask 1 (20%): x=yx=y.
  • Subtask 2 (30%): x≠yx\ne y and zz is divisible by x+yx+y.
  • Subtask 3 (50%): Full constraints: 1≤x,y≤101\le x,y\le10, 1≤z≤10001\le z\le1000.

Examples

Input

5 4 90

Output

60

Explanation

A and B worked a total of

5+4=95+4=9

hours. A fair three-way share is 9/3=39/3=3 hours per family.

A worked 5−3=25-3=2 hours beyond its share, while B worked 4−3=14-3=1 extra hour. Thus the 9090 dollars compensate 2+1=32+1=3 excess hours, which is 90/3=3090/3=30 dollars per excess hour. Family A receives

2⋅30=602\cdot30=60

dollars, so the program prints 60.