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

int main() {

  string in;

  while( cin >> in ) {

    while( in.size() > 1 ) {

      string o = "";
      for ( int i = 0; i < in.size()-1; i++ ) {
	o += '0' + ( in[i] - '0' + in[i+1] - '0' ) % 10;
      }
      in = o;

    }

    cout << in << endl;

  }

  return 0;

}