链接http://codeforces.com/problemset/problem/732/A
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int k,r;
cin>>k>>r;
int i=1;
for(;;i++){
if((i*k%10==0)||(i*k-r)%10==0)
break;
}
printf("%d\n",i);
return 0;
}