#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)
using Integer = long long;
using Real = long double;
const Real PI = acos(-1);
const Real E = exp(1);

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S, T, U> t) {
  return os << '(' << get<0>(t) << ", " << get<1>(t)
    << ", " << get<2>(t) << ')';
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);

  loop {
    string s; cin >> s;
    if (not cin) break;
    int n = s.size();
    vi 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;
}