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) {
        while (input.length > 1) {
            string output;
            for (int i = 0; i < input.length-1; i++) {
                output ~= (((input[i] - '0')+(input[i+1] - '0'))%10).to!string;
            }
            input = output;
        }

        writeln(input);
    }
}