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

int main() {
	long long int n;
	int tmp[10];
	vector<int> r;
	while(cin >> n)
	{
		for (int i=0; i<10; i++)
		{
			tmp[i] = n%10;
			n/=10;
		}
		for (int i=0; i<9; i++)
		{
			for (int j=0; j<9-i; j++)
			{
				tmp[j] = (tmp[j] + tmp[j+1]) % 10;
			}
		}
		r.push_back(tmp[0]);
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
}