#include <deque>
#include <iostream>
#include <string>

using namespace std;

int main() {
	
	string s;
	deque <int> x;

	while(cin >> s) {
		x.clear();
		for(int i=0; i<10; i++) {
			x.push_back(s[i]-48);
		}
		while(x.size()!=1) {
			for(int i=0; i<x.size()-1; i++) {
				if(x[i]+x[i+1]<=9)
					x[i]+=x[i+1];
				else
					x[i]+=x[i+1]-10;
				if(i==x.size()-2)
					x.pop_back();
			}
		}
			cout << x[0] << endl;
	}

	return 0;

}