#include <iostream>

using namespace std;

void solve()
{
	unsigned long long int num;
	while(cin >> num)
	{
		int a[10][10];
		for(int i = 9; i >= 0; --i)
		{
			a[0][i] = num % 10;
			num /= 10;
		}
		for(int i = 0; i < 9; ++i)
		{
			for(int j = 0; j < 9 - i; ++j)
			{
				a[i + 1][j] = (a[i][j] + a[i][j + 1]) % 10;
			}
		}
		cout << a[9][0] << endl;
	}
}

int main()
{
	solve();
	return(0);
}