#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.bottom", "r", stdin);
	string str = "";
	while (getline (cin, str ) ){
		if (str.empty() ){
			break;
		} // end if
		vector <vector <int> > n (10, vector <int> (10, 0 ) );
		int i,j;

		for (i = 0; i < 10; ++i){
			n[0][i] = str[i] - '0';
		} // end for
		
		for (i = 0; i < 9; ++i){
			for (j = 0; j < 9 - i; ++j){
				n[i+1][j] = (n[i][j] + n[i][j+1]) % 10;
			} // end for
		} // end for
/*
		for (i = 0; i < 10; ++i){
			for (j = 0; j < 10; ++j){
				cout << n[i][j] << ' ';
			} // end for
			cout << endl;
		} // end for
		cout << endl;
*/
		cout << n[9][0] << endl;

	} // end loop
		
	return 0;
}