#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)


int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(6);

  int INF = 1000000;

  string str="";
  while(cin >> str){
    int num[str.size()];
    REP(i,str.size()){
      num[i] = str[i] - '0';
    }

    REP(i, 9){
      int n2[str.size()];
      memcpy(n2,num,sizeof(num));
      
      REP(j, str.size()-i-1){
	num[j] = (n2[j]+n2[j+1]) % 10;
      }
    }

    cout << num[0] << endl;
  }

  return 0;
}