#include <string>
#include <iostream>

using namespace std;

const int dp[10] = { 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 };

int solve(string S)
{
	int sum = 0;

	for (int i = 0; i < 10; i++)
	{
		sum += (S[i] - 48) * dp[i];
	}
	
	return sum % 10;
}

int main()
{
	string S;

	while (cin >> S)
	{
		cout << solve(S) << endl;
	}

	return 0;
}