//What is the Bottommost?
#include<bits/stdc++.h>
using namespace std;

int main(){
  string s;
  while(cin>>s){
    int sum=0;
    for(int i=0; i<s.length(); i++)s[i]-='0';
    sum+=(s[0]+s[9]);
    sum+=(s[1]+s[8])*9;
    sum+=(s[2]+s[4]+s[5]+s[7])*6;
    sum+=(s[3]+s[6])*4;
    cout<<sum%10<<endl;
  }
  return 0;
}