Codeforces Round 377 (Div. 2)
A
Buy a Shovel
Codeforces
800
原题
←B →
翻译中…

Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for $*k*$ burles. Assume that there is an unlimited number of such shovels in the shop.

翻译中…

In his pocket Polycarp has an unlimited number of "10-burle coins" and exactly one coin of $*r*$ burles ($1 ≤ *r* ≤ 9$).

翻译中…

What is the minimum number of shovels Polycarp has to buy so that he can pay for the purchase without any change? It is obvious that he can pay for 10 shovels without any change (by paying the requied amount of 10-burle coins and not using the coin of $*r*$ burles). But perhaps he can buy fewer shovels and pay without any change. Note that Polycarp should buy at least one shovel.

翻译中…

Input

翻译中…

The single line of input contains two integers $*k*$ and $*r*$ ($1 ≤ *k* ≤ 1000$, $1 ≤ *r* ≤ 9$) — the price of one shovel and the denomination of the coin in Polycarp's pocket that is different from "10-burle coins".

翻译中…

Remember that he has an unlimited number of coins in the denomination of 10, that is, Polycarp has enough money to buy any number of shovels.

翻译中…

Output

翻译中…

Print the required minimum number of shovels Polycarp has to buy so that he can pay for them without any change.

翻译中…

Note

翻译中…

In the first example Polycarp can buy 9 shovels and pay $9·117 = 1053$ burles. Indeed, he can pay this sum by using 10-burle coins and one 3-burle coin. He can't buy fewer shovels without any change.

翻译中…

In the second example it is enough for Polycarp to buy one shovel.

翻译中…

In the third example Polycarp should buy two shovels and pay $2·15 = 30$ burles. It is obvious that he can pay this sum without any change.

翻译中…

样例

Input #1
117 3
Output #1
9
InputCopy OutputCopy
Input #2
237 7
Output #2
1
InputCopy OutputCopy
Input #3
15 2
Output #3
2
InputCopy OutputCopy
题目信息
题号
732A
时间限制
1 s
内存限制
256 MB
标签
暴力
构造
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。