#include <cstdio>
#include <cstring>
int main() {
	char top[10];
	while (scanf("%s", top)) {
		int nums[10];
		for (int i=0; i<10; i++) nums[i] = top[i] - '0';
		for (int i=1; i<10; i++) {
			int res[10-i];
			for (int j=0; j<10-i; j++) res[j] = nums[j] + nums[j+1];
			memcpy(nums, res, sizeof(res));
		}
		nums[0] %= 10;
		printf("%d\n", nums[0]);
	}
}