#include <iostream>
#include <iomanip>
#include <vector>

std::string s;

void solve( std::string s ) {
    std::vector<int> v;
    for (int i=0; i<s.length(); ++i) {
        v.push_back( s[i] - '0' );    
    }
    /*
    std::cout << "INITIAL STATE OF VECTOR V :\n";
    for (std::vector<int>::iterator itr=v.begin(); itr != v.end(); ++itr) std::cout << std::setw(2) << *itr;
    std::cout << std::endl;
    */
    for (int i=v.size()-1; i>0; --i) {
        std::vector<int> w;
        for (int j=0; j<i; ++j) {
            int a = (v[j] + v[j+1])%10;
            w.push_back( a );
        }
        v = w;
        /*
        for (std::vector<int>::iterator itr=v.begin(); itr != v.end(); ++itr) std::cout << std::setw(2) << *itr;
        std::cout << std::endl;
        */
    }
    std::cout << *(v.begin()) << std::endl;
}

int main() {
    while (std::cin >> s) {
        solve( s );
    }
    return 0;
}

