#include <iostream>
#include <string>
using namespace std;

int main(){
    string s;
    while(cin >> s){
	int a[10];
	for(int i=0;i<10;i++){
	    a[i] = s[i] - (int)'0';
	}
	int n = 10;
	while(n>0){
	    for(int i=0;i<n-1;i++){
		a[i] = (a[i] + a[i+1])%10;
	    }
	    n--;
	}
	cout << a[0] << endl;
    }
   return 0;
}