#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	int seq[10] = {};
	string str;
	while (cin >> str) {
		for (int i = 0; i < 10; i++)
			seq[i] = str[i] - '0';
		int num = 9;
		while (num > 0) {
			for (int i = 0; i < num; i++) {
				seq[i] = seq[i] + seq[i+1];
				if (seq[i] > 9)
					seq[i] -= 10;
			}
			num--;
		}
		cout << seq[0] << endl;
	}
	return 0;
}