#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string s;
	while(cin >> s) {
		int a[10];
		rep(i,10) { 
			a[i] = s[i] - '0';
		}
		int cnt = 9;
		while(cnt) {
			rep(i,cnt) {
				a[i] = (a[i+1] + a[i]) % 10;
			}
			cnt--;
		}
		cout << a[0] << endl;
	}
	return 0;
}