/*
#include <stdio.h>
int f(int n)
{
int sum=0;
while(n!=0)
{
sum+=n%10;
n=n/10;
}
return sum;
}
int main()
{
int n, m;
scanf("%d",&n);
for (;;)
{
m = f(n);
// n의 자릿수의 합 구하기
if(m<10)
{
break;
}
else
{
n=m;
}
}
printf ("%d",m);
}
*/
#include <stdio.h>
long long int n;
long long int f(long long int inputnumber)
{
long long int r=0;
while (inputnumber!=0)
{
r=r*10+inputnumber%10;
inputnumber/=10;
}
return r;
}
int main()
{
scanf("%lld", &n);
printf("%lld\n", f(n));
}