#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{	string s;

while (cin >> s){
	int p[10][10] = { 0 };

	char  in[2];
	for (int i = 0; i < s.size(); i++){
		in[0] = s[i];
		in[1] = '\0';
		p[0][i] = atoi(in);
	}
	for (int i = 0; i < 9; i++){
		for (int i2 = i; i2 < 9; i2++){
			int a = p[i][i2] + p[i][i2 + 1];
			if (a >= 10){
				p[i + 1][i2 + 1] = a % 10;
			}
			else{
				p[i + 1][i2 + 1] = a;
			}
		}
	}
	cout << p[9][9] << endl;
}
}