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

int main()
{
	string ary;

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

		cout << ary[0] << endl;
	}

	return 0;
}