#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
	int a[10], b[10], i, j;
	char s[11], t;
	while (cin >> s)
	{
		for (i = 0; i < 10; i++)
			t = s[i], a[i] = b[i] = atoi(&t);
		for (i = 0; i < 10; i++)
		{
			for (j = 0; j < 10-i; j++)
				a[j] = b[j];
			for (j = 0; j < 10-i; j++)
				b[j] = (a[j] + a[j+1]) % 10;
		}
		cout << a[0] << endl;
	}
}