#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a[1000], b=9, t = 0;
gets(a);
while ( len > 0 && a[len] != 0 )
len--;
for (int i = len; i >= 0; --i)
{
t = t * 10 + a[i]; //t为当前余数
t = t % b;
}
cout << t << endl;
return 0;
}
#include<cstdio>
using namespace std;
int main()
{
int a[1000], b=9, t = 0;
gets(a);
while ( len > 0 && a[len] != 0 )
len--;
for (int i = len; i >= 0; --i)
{
t = t * 10 + a[i]; //t为当前余数
t = t % b;
}
cout << t << endl;
return 0;
}