#include<iostream>
#include<cctype>
#include<cstdlib>
#include<vector>
#include<string>
using namespace std;

int one_string_int(string& c, int num) {
	string str[2];
	str[0] = c[num];
	return atoi(str->c_str());
}

int main() {
	string nums; string tmp;  vector<char> anss;
	while(cin>>nums){
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9 - i; j++) {
				tmp=to_string(one_string_int(nums, j) + one_string_int(nums, j + 1));
				if (tmp.length() == 2)nums[j] = tmp[1];
				else nums[j] = tmp[0];
			}
		}
		anss.push_back(nums[0]);
	}
	for (int i = 0; i < anss.size(); i++){
		cout << anss[i] << endl;
	}
}