CF732A.Buy a Shovel

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for kk 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 rr burles ( 1<=r<=91<=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 rr burles). But perhaps he can buy fewer shovels and pay without any change. Note that Polycarp should buy at least one shovel.

输入格式

The single line of input contains two integers kk and rr ( 1<=k<=10001<=k<=1000 , 1<=r<=91<=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.

输出格式

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

输入输出样例

  • 输入#1

    117 3
    

    输出#1

    9
    
  • 输入#2

    237 7
    

    输出#2

    1
    
  • 输入#3

    15 2
    

    输出#3

    2
    

说明/提示

In the first example Polycarp can buy 9 shovels and pay 9117=10539·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 215=302·15=30 burles. It is obvious that he can pay this sum without any change.

首页