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

int solve(int[] list) {
  while (list.length > 1) {
    int[] res = new int[](list.length - 1);
    for(int i = 0; i < list.length - 1; i++) {
      res[i] = (list[i] + list[i + 1]) % 10;
    }
    list = res;
  }
  return list[0];
}

void main() {
  string line;
  while ((line = readln.chomp).length != 0) {
    line.array.map!((x) => x.to!(int) - '0').array.solve.writeln;
  }
}