#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  string s;
  while(cin>>s){
    vector<int> t;
    REP(i,9){
      char a=s[i]-'0';
      char b=s[i+1]-'0';
      int tmp=(a+b)%10;
      t.PB(tmp);
    }
    REP(j,9){
      vector<int> u;
      REP(i,t.size()-1){
        u.PB((t[i]+t[i+1])%10);
      }
      t=u;
    }
    cout<<t[0]<<endl;
  }
  return 0;
}


