#BS0000065. Hóa đơn điện (Electric Bill)

Hóa đơn điện (Electric Bill)

Electric Bill

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Electricity uses progressive rates: first 100 CWh cost 2 each, next 9900 cost 3 each, next 990000 cost 5 each, and the rest cost 7 each. Let C(x)C(x) be the bill for xx CWh. Given A=C(x+y)A=C(x+y) and B=∣C(x)−C(y)∣B=|C(x)-C(y)|, with x≤yx\le y and a unique solution, find C(x)C(x).

Input

The only line contains A,BA,B.

Output

Print your bill C(x)C(x).

Subtasks

  • Subtask 1 — 20%: total consumption ≤10000\le10000.
  • Subtask 2 — 30%: total consumption ≤1000000\le1000000.
  • Subtask 3 — 50%: 1≤A,B≤1091\le A,B\le10^9 and the solution is unique.

Example

Input

1100 300

Output

350

Explanation

The combined consumption is 400 CWh; consumptions 150 and 250 produce bills 350 and 650.