#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int tri[10][10];

int main()
{
//	cut here before submit 
//	freopen ("testcase.WB", "r", stdin );
	string str = "";
	while (cin >> str ){
		memset (tri, 0, sizeof (tri ) );		
		rep (j, 10 ){
			tri[0][j] = (int)(str[j] - '0' );
		} // end rep
		for (int i = 1; i < 10; i++ ){
			for (int j = 0; j < 10-i; j++ ){
				tri[i][j] = (tri[i-1][j] + tri[i-1][j+1] ) % 10;
			} // end for
		} // end for
/*
		rep (i, 10 ){
			rep (j, 10 ){
				cerr << setw(2) << tri[i][j];
			} // end rep
			cerr << endl;
		} // end rep
*/
		cout << tri[9][0] << endl;
	} // end loop

//	printf ("%d\n", res );
		
	return 0;
}