#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
   string s;
   while(cin>> s){
      //string tmp;
      //while(s.size()!=1){
         //for(int i=0;i<s.size()-1;i++){
            //tmp.push_back((s[i]-'0')+(s[i+1]-'0')%10);
            //cout<< tmp << endl;
            //cout << to_string((s[i]-'0')+(s[i+1]-'0')%10) << endl;
         //}
         //s.clear();
         //s=tmp;
      //}
      //cout << s << endl;
      int a[10][10];
      for(int i=0;i<10;i++) {a[0][i]=s[i]-'0';}
      for(int i=1;i<10;i++){
         for(int j=0;j<10-i;j++){
            a[i][j]=(a[i-1][j]+a[i-1][j+1])%10;
            //if(i==1)cout << a[i][j] << endl;
         }
      }
      cout << a[9][0] << endl;
   }
}