import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	foreach (line; stdin.byLine) {
		auto p = line.map!(a=>a.to!int-'0').array;
		foreach (i; 0..10) {
			foreach (j; 0..9-i) {
				p[j] = p[j] + p[j+1];
			}
		}
		writeln(p[0]%10);
	}
}