#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main()
{
	string str;
	int data[10][10];
	while (cin>>str)
	{
		for (int j = 0; j < 10; j++)
		{
			data[0][j] = str[j] - '0';
		}

		for (int i = 0; i < 10; i++)
		{
			for (int j = 0; j < 9-i ; j++)
			{
				data[i + 1][j] = (data[i][j] + data[i][j + 1]) % 10;
			}
		}

		cout << data[9][0] << endl;
	}

	return 0;
}