#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  while (cin >> s) {
    vector<int> prev, next;
    for (int i = 0; i < 10; i++) {
      prev.emplace_back(s[i] - '0');
    }
    while (prev.size() > 1) {
      next.clear();
      for (int i = 0; i + 1 < (int)prev.size(); i++) {
        next.emplace_back((prev[i] + prev[i + 1]) % 10);
      }
      swap(prev, next);
    }
    cout << prev[0] << endl;
  }

  return 0;
}
