#include <iostream>
using namespace std;
int main()
{
int a[10],i,j;
while(scanf("%1d", &a[0])!=EOF){
for(i = 1; i < 10; i++)scanf("%1d",&a[i]);
for(i = 9; i >= 0; i--)
for(j = 0; j < i; j++)
a[j]=a[j]+a[j+1]-((a[j]+a[j+1])/10)*10;
cout<<a[0]<<endl;
}
return 0;
}