#include<stdio.h>
#include<string.h>

int main(void){
	char x[128];
	
	while(scanf("%s", x)!=EOF){
		
		for(int i = 9; i > 0; i--){
			char s[128];
			strcpy(s,x);
			for(int j = 0; j < i; j++){
				s[j] = x[j]+x[j+1]-'0';
				if(s[j]-'0'>9)s[j]-=10;
			}
			strcpy(x,s);
//			puts(x);
		}
		printf("%c\n", x[0]);
	}
	
	return 0;
}