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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

int main() {
  loop {
    string s; cin >> s;
    if (not cin) break;
    int n = s.size();
    vector<int> xs(n);
    rep (i, n) xs[i] = s[i] - '0';
    for (;n>1;--n)
      rep (i, n) xs[i] = (xs[i] + xs[i+1]) % 10;
    cout << xs[0] << endl;
  }

  return 0;
}