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

int main() {
  string s;
  while(getline(cin,s)) {
    while(true) {
      if( s.length() == 1 ) {
	cout<<s<<endl;
	break;
      }
      string l;
      for(int i=0; i<s.length()-1; i++)
	l += string( 1, ((s[i]-'0')+(s[i+1]-'0'))%10+'0');
      s = l;
    }
  }
}