import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    foreach(s;stdin.byLine())
    {
        int[] a;
        foreach(c;s) a~=c-'0';
        foreach_reverse(i;1..a.length)
            foreach(j;0..i) a[j]=(a[j]+a[j+1])%10;
        writeln(a[0]);
    }
}