#include<cstdio>
using namespace std;
int main(){
	
	char str[16] ={0};
	
	while(scanf("%s",str) != EOF){
		
		int num[16] = {0};
		
		for(int i = 0;i < 10; i++){
			
			num[i] = str[i] - 48;
			
		}
		
		int x = 9;
		int ans[16] = {0};
		
		for(int i = 0; i < x; i++){
			for(int j = 0; j < x; j++){
				ans[j] = (num[j]+num[j+1])%10;
				num[j] = ans[j];
			}
		}
		
		printf("%d\n",ans[0]);
		
	}
	
	return 0;
}