#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<climits>
#include<cmath>

#define f first
#define s second
#define mp make_pair

#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()

typedef unsigned int uint;
typedef long long ll;

using namespace std;

int ans(int *a, int n){
  if(n == 1) return a[0];
  int b[10];
  REP(i,n-1){
    b[i] = (a[i] + a[i+1]) % 10;
  }
  return ans(b, n-1);
}

int main(){
  char buff[16];
  while(cin>>buff){
    int a[10];
    REP(i,10) a[i] = buff[i] - '0';
    cout << ans(a,10) << endl;
  }
}