题库练习 Make It Round
← 上一题 下一题 →

A15519 | Make It Round

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Inflation has occurred in Berlandia, so the store needs to change the price of goods.

The current price of good $n$ is given. It is allowed to increase the price of the good by $k$ times, with $1 \le k \le m$ , k is an integer. Output the roundest possible new price of the good. That is, the one that has the maximum number of zeros at the end.

For example, the number 481000 is more round than the number 1000010 (three zeros at the end of 481000 and only one at the end of 1000010).

If there are several possible variants, output the one in which the new price is maximal.

If it is impossible to get a rounder price, output $n \cdot m$ (that is, the maximum possible price).

输入格式

The first line contains a single integer $t$ ( $1 \le t \le 10^4$ ) —the number of test cases in the test.

Each test case consists of one line.

This line contains two integers: $n$ and $m$ ( $1 \le n, m \le 10^9$ ). Where $n$ is the old price of the good, and the number $m$ means that you can increase the price $n$ no more than $m$ times.

输出格式

For each test case, output on a separate line the roundest integer of the form $n \cdot k$ ( $1 \le k \le m$ , $k$ — an integer).

If there are several possible variants, output the one in which the new price (value $n \cdot k$ ) is maximal.

If it is impossible to get a more rounded price, output $n \cdot m$ (that is, the maximum possible price).

输入输出样例

输入 #1
10
6 11
5 43
13 5
4 16
10050 12345
2 6
4 30
25 10
2 81
1 7
输出 #1
60
200
65
60
120600000
10
100
200
100
7
C++ 编辑器
输入
输出