#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    char input[10];
    int number[10] = {0};
    int x[10] = {1,9,36,84,126,126,84,36,9,1};
    int sum;
    while(cin >> input){
        sum = 0;
        rep(i,10){
            number[i] = input[i] - '0';
            sum+= (number[i] * x[i]);
        }
        cout << sum % 10 << endl;
    }
}