Sim Card

For each student, compute the smallest total cost of call minutes and data across the three fixed operator price plans.

Easy1ImplementationBrute forceMathInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Iran has three mobile operators. Each operator charges a different price for calls and for data, as listed in the table below. All prices are in Rials.

#NameCall (per minute)Data (per megabyte)
1ParsTel3040
2ParsCell3530
3ParsPhone4020

Several foreign students came to Iran for a programming contest. Each student already knows how many minutes of calls and how many megabytes of data they will use. For each student, recommend the operator that makes the total of the call charge and the data charge as small as possible.

Input

Each line of the input holds the information of one student: two positive integers cc and dd (1c,d10001 \le c, d \le 1000), the call time in minutes and the data usage in megabytes. The input ends with a line 0 0, which you do not process.

Output

For each student, print the minimum total of the call charge and the data charge on its own line, in input order.