#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  string s;
  while(cin>>s) {
    vector<int> v;
    REP(i,s.length())
      v.push_back(s[i]-'0');
    
    while(v.size()>1) {
      vector<int> vv;
      REP(i,v.size()-1) {
        int a = v[i]+v[i+1];
        if (a >= 10) a-=10;
        vv.push_back(a);
      }
      v = vv;
    }
    cout << v[0] << endl;
  }
}