#include <bits/stdc++.h>
using namespace std;

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int a[13][13];

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

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

	return 0;
}