#include <iostream>
using namespace std;
const int INF=1<<29;
signed main(){
int a, b, c; 
while(cin >> a){
cin >> b >> c;
int s=0
for(int i=10;a*i<INF;i*=10) s+=a*i%10;
cout << s << endl;
}
return 0;
}