#include<iostream>
#include<string>
using namespace std;
int main(){
  string in;
  while(cin>>in!='\0'){
    int j=1;
    while((in.size()-j)!=0){
      int i;
      for(i=0;i<in.size()-j;i++){
	in[i]+=in[i+1]-'0';
	if(in[i]>'9')
	  in[i]-=10;
      }
      //cout << in<<endl;
      in[i]='\0';
      //cout << in[i] << endl;
      cout << in.length()<<endl;
      //break;
      j++;
    }
    cout << in[0] << endl;
  }
}