#include <cstdio>

using namespace std;

int main() {
  char s[16];
  while (scanf("%s", s) == 1) {
    for (int i = 0; i < 10; i++)
      s[i] -= '0';
    for (int j = 9; j >= 1; j--)
      for (int i = 0; i < j; i++)
        s[i] = (s[i] + s[i+1]) % 10;
    printf("%c\n", s[0] + '0');
  }
  return 0;
}