#include <bits/stdc++.h>
using namespace std;

int main()
{
  int num[11][11];
  string number;

  cin >> number;
  for (int i = 0; i < number.size(); i++){
    num[0][i] = number[i] - '0';
  }

  for (int i = 1; i < 10; i++){
    for (int j = 1; j < 10; j++){
      num[i][j] = (num[i - 1][j - 1] + num[i - 1][j]) % 10;
    }
  }
  cout << num[9][9] << endl;
}