#include <stdio.h>

int main(void)
{
	char c[20];
	int a[10];
	int ans;
	while(scanf("%s", c) != EOF){
		for(int i = 0; i < 10; i++){
			a[i] = c[i] - '0';
		}
		ans = (a[0] + a[9] + (a[1] + a[8]) * 9 +(a[2] + a[7]) * 36 + (a[3] + a[6]) * 84 + (a[4] + a[5]) * 126) % 10;
		printf("%d\n",ans);
	}
	return 0;
}