#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;

const int N = 10;
int G[N+1][N];

int main() {
  string line;
  while(cin >> line) {
    stringstream ss;
    ss << line;
    for(int i = 0; i < N; ++i) {
      char c;
      ss >> c;
      G[N][i] = c-'0';
    }
    for(int i = N-1; i >= 1; --i) {
      for(int j = 0; j < i; ++j) {
	G[i][j] = (G[i+1][j] + G[i+1][j+1])%10;
      }
    }
    cout << G[1][0] << endl;
  }
  return 0;
}