#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <map>


#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

string ws;
	while(cin >> ws){
		if( cin.eof()) break;
		int c[10][10]={0};
		rep(i,10) c[0][i] = ws[i] - '0';
		rep2(i,1,10){
			rep(j,10){
				c[i][j] = (c[i-1][j] + c[i-1][j+1])%10;
			}
//			rep(j,10) cout << c[i][j] << " "; cout <<":q"<< endl;
		}
		cout << c[9][0]  <<endl;
	}
	return 0;
	
	
}