import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    while(true){
	auto s = readln();
	if(stdin.eof()) break;
	s = chomp(s);
	string s1,s2;
	s1 = s;
	int count = 9;
	while(count){
	    count--;
	    for(int i=0;i<s1.length-1;i++){
		s2 ~= to!char( '0' + (to!int(s1[i]-'0') + to!int(s1[i+1]-'0'))%10);
	    }
	    swap(s1,s2);
	    s2 = "";
	}
	writeln(s1);
    }
}