#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(){
  char d;
  while(cin>>d){
    vector<int>in(10);
    in[0]=d-'0';
    char d;
    rep(i,9){
      cin>>d;
      in[i+1]=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;
  }
}