#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
using namespace std;

string makebottom(string s) {
  int x[10000],size;
  string news = "";
  stringstream ss;
  size = s.size();

  for(int i=0;i<size;i++) {
    x[i] = atoi(s.substr(i,1).c_str());
  }

  for(int i=0;i<size-1;i++) {
    ss << (x[i] + x[i+1]) % 10;
    news += ss.str();
    ss.str("");
    ss.clear(stringstream::goodbit);
  }

  if(news.size() != 1)
    return makebottom(news);
  else if(news.size() == 1)
    return news;
}


  int main() {
    string str;
    while(cin >> str) {
      cout << makebottom(str) << endl;
    }
  }