#include<bits/stdc++.h>
using namespace std;
int a[21] = {0,1,4,7,6,5,6,3,6,9,0,1,6,3,6,5,6,7,4,9,0};
int main()
{
string s;
while(cin >> s)
{
if(s == "0")
break;
int r = 0, l = s.size(), i;
for(i=0;i<l;i++)
{
r = (r*10+s[i] - '0')%100;
}
int n = 0;
if(r > 20)
{
int m = r/20;
for(i=1;i<=m;i++)
n += 4;
r = r%20;
}
for(i=1;i<=r;i++)
{
n = (n+a[i])%10;
}
cout << n << endl;
}
return 0;
}
using namespace std;
int a[21] = {0,1,4,7,6,5,6,3,6,9,0,1,6,3,6,5,6,7,4,9,0};
int main()
{
string s;
while(cin >> s)
{
if(s == "0")
break;
int r = 0, l = s.size(), i;
for(i=0;i<l;i++)
{
r = (r*10+s[i] - '0')%100;
}
int n = 0;
if(r > 20)
{
int m = r/20;
for(i=1;i<=m;i++)
n += 4;
r = r%20;
}
for(i=1;i<=r;i++)
{
n = (n+a[i])%10;
}
cout << n << endl;
}
return 0;
}
Comments
Post a Comment