#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
using namespace std;
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
int main(){
  vector<int>in(10);
  char d;
  rep(i,10){
    cin>>d;
    in[i]=d-'0';
  }
  while(in.size()!=1){
    rep(i,in.size()-1)
      in[i]=(in[i]+in[i+1])%10;
    in.pop_back();
  }
  cout<<in[0]<<endl;
}