#include <bits/stdc++.h>
using namespace std;
int main(void) {
    string s;
    std::deque<int> deq;
    while (cin>>s) {
        for (int i=0;i<s.size();i++) {
            deq.emplace_back(s.at(i)-48);
        }
        for (int j=9;j>0;j--) {
            for (int k=0;k<j;k++) {
                int sum = deq[k]+deq[k+1];
                int keta = sum-((sum/10)*10);
                deq.emplace_back(keta);
            }
            deq.erase(deq.begin(),deq.begin()+j+1);
        }
        cout<<deq[0]<<endl;
        deq.clear();
    }
}
