#include <iostream>
#include <string>
using namespace std;

int main(void)
{
	string str;

	while (cin >> str)
	{
		int num[10][10] = {};
		for (int i = 0; i < 10; i++) num[0][i] = str[i] - '0';
		for (int i = 1; i < 10; i++)
			for (int j = 0; j < 10 - i; j++)
				num[i][j] = (num[i - 1][j] + num[i - 1][j + 1]) % 10;
		cout << num[9][0] << endl;
	}
	return 0;
}
