#include <iostream>

using namespace std;

int main() {

  while (true) {
    int seq[10];
    for (int i = 0; i < 10; ++i) {
      char c;
      cin >> c;
      seq[i] = int(c - '0');
    }

    if (cin.fail())
      break;

    for (int i = 9; 0 <= i; --i)
      for (int j = 0; j < i; ++j)
        seq[j] = (seq[j] + seq[j+1]) % 10;

    cout << int(seq[0]) << endl;
  }

}
