The electricity company has raised its rates again. The new rates are shown in the table below. (Usage is always a positive integer.)
| Usage (Wh) | Rate (won per Wh) |
|---|---|
| 1 ~ 100 | 2 |
| 101 ~ 10000 | 3 |
| 10001 ~ 1000000 | 5 |
| more than 1000000 | 7 |
The bill is charged progressively by tier: the first 100 Wh cost 2 won per Wh, the next 9900 Wh (101 ~ 10000) cost 3 won per Wh, the next 990000 Wh (10001 ~ 1000000) cost 5 won per Wh, and every Wh beyond 1000000 costs 7 won per Wh.
For example, using 10123 Wh costs 2×100 + 3×9900 + 5×123 = 30515 won.
The company invented a strange way to earn more without raising rates: instead of telling you your usage, it only tells you two integers A and B, computed together with one randomly chosen neighbor from the same building.
If you cannot determine your own bill from these two numbers, you may pay an extra 100-won service fee to have the company reveal the usage.
Sanggeun is very frugal with electricity and is certain that he uses the least in his building; that is, he is the one of the two who uses less. He is also frugal with money, so he refuses to pay the fee and computes his bill himself.
For example, suppose A = 1100 and B = 300. Then Sanggeun's usage is 150 Wh and his neighbor's is 250 Wh. Their combined usage is 400 Wh, whose bill is 2×100 + 3×300 = 1100 won, so A = 1100. Sanggeun's own bill is 350 won and his neighbor's is 2×100 + 3×150 = 650 won, so B = |350 - 650| = 300. Therefore Sanggeun must pay 350 won.
Given A and B, write a program that computes the bill Sanggeun has to pay.
The input consists of several test cases. Each test case is a single line containing two integers A and B ($1 \le A, B \le 10^9$). Every test case has a unique answer: there is exactly one pair of usages that produces the given A and B.
The last line of the input contains two zeros and must not be processed.
For each test case, print the bill Sanggeun has to pay on its own line.