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

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x)   (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second
#define pf printf
#define sf scanf

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  ll n;
  int num[10];
  while(sf("%lld",&n)!=EOF){
    for(int i=9;i>=0;i--){
      num[i]=(n%10);
      n/=10;
    }

    for(int i=8;i>=0;i--){
      rep(j,i+1){
	num[j]=(num[j]+num[j+1])%10;
      }
    }
    cout<< num[0]<< endl;
  }


}