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);
	if(s=="")break;
	string s1,s2;
	s1 = s;
	s2 = s;
	while(s1.length > 1){
	    s2 = "";
	    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);
	}
	writeln(s1);
    }
}