#include<iostream>
#include<cmath>
using namespace std;
int x[10][11]; long long a;
int main() {
	while (cin >> a) {
		for (int i = 9; i >= 0; i--) {
			x[0][i] = (a / (int)pow(10, i)) % 10;
		}
		for (int i = 1; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				x[i][j] = x[i - 1][j] + x[i - 1][j + 1];
			}
		}
		cout << x[9][0] % 10 << endl;
	}
}