#include<iostream>
#include<stdio.h>
#include<ctype.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<stdlib.h>
#include<algorithm>
#include<functional>

using namespace std;

#define OUT cout <<
#define IN cin >>
#define E << endl;
#define FOR(i,a,b) for(int i = a;i < b;i++)

char c[10];
int array1[10];
int array2[10];

void input(){
	FOR(i, 0, 10){
		array1[i] = c[i] - '0';
	}
}

int main(){
	while(IN c){
		input();
		for(int i = 9; i >= 0; i--){
			for(int j = 0; j <  i; j++){
				array2[j] = (array1[j] + array1[j + 1]) % 10;
	     	}
			for(int j = 0; j <  i; j++){
				array1[j] = array2[j];
			}
		}	
		OUT array1[0] E
	}

}