#include <iostream>
#include <string>
using namespace std;

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