#include<bits/stdc++.h>
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

vector<int>v[11];
int main() {
	string s; 
	while (cin >> s) {
		rep(i, 11)v[i].clear();
		int cnt = 0;
		rep(i, 10)v[0].push_back((int)s[i] - 48);
		for (int i = 1; i <= 10; i++) {
			rep(j, v[i - 1].size() - 1)
				v[i].push_back((v[i - 1][j] + v[i - 1][j + 1]) % 10);
		}
		cout << v[9][0] << endl;
	}
	return 0;
}