#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
using namespace std;

int main()
{
	string s;
	while(cin >> s){
		int n[10];
		for (int i = 0; i < 10; ++i)
		{
			n[i] = s[i] - '0';	
		}
		for (int i = 0; i < 9; ++i)
		{
			for (int i = 0; i < 9; ++i)
			{
				n[i] = (n[i] + n[i + 1]) % 10;
			}
		}
		cout << n[0] << endl;
	}
}