//0062

#include<stdio.h>

int main(void)
{
	const int N = 10;
	char str[N+1];
	int i, j;
	while(scanf("%s", str) == 1)
	{
		for(i = N; i > 1; i--)
		{
			for(j = 0; j < i-1; j++)
			{
				str[j] = (str[j] - '0' + str[j+1] - '0') %10 + '0';
			}
		}
		putchar(str[0]);
		putchar('\n');
	}
	return 0;
}