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

void main() {
    string input;

    while ((input = readln.chomp).length != 0) {
        auto line = input.map!(a => a.to!int - '0').array;

        while (line.length > 1) {
            for (int i = 0; i < (line.length - 1); i++) {
                line[i] = line[i] + line[i+1];
            }
            line.popBack;
        }

        writeln(line.front % 10);
    }
}