#include<stdio.h>
int main(void)
{
	int s[11][11],d,f,g,h,i,j;
	long long int a;
	while(scanf("%ld",&a)!=EOF){
	for(i=10;i>=1;i--){
		s[1][i]=a%10;
		a=a/10;

	}
	f=10;
	for(j=1;j<=10;j++){
		for(i=1;i<=f;i++){
			s[j+1][i]=s[j][i]+s[j][i+1];
			s[j+1][i]=s[j+1][i]%10;
		//printf(" %d",s[j][i]);
		}
		//printf("\n");
		f--;
	}
	printf("%d\n",s[10][1]);
	}
	return 0;
}