#include <iostream>
#include <cstring>

using namespace std;

string str;
int a[16][16];

int main(){

	while(cin>>str, !cin.eof()){
		
		memset(a, 0, sizeof(a));
		
		for(int i=0; i<10; ++i){
			a[10][i] = str[i]-'0';
		}

		for(int t=10; t>=2; --t){

			for(int i=0; i<t; ++i){
				a[t-1][i] = (a[t][i] + a[t][i+1])%10;
			}
		}
		
		cout << a[1][0] << endl;
	}

	return 0;
}