#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(7);

    string s;
    while (cin >> s)
    {

        int n = s.size();
        vector<int> ans;

        for (int i = 0; i < n; ++i)
        {
            ans.push_back(s[i] - '0');
        }
        while (1)
        {
            vector<int> v;
            for (int i = 0; i < ans.size() - 1; ++i)
            {
                v.push_back((ans[i] + ans[i + 1]) % 10);
            }
            ans = v;
            if (v.size() == 1)
                break;
        }
        cout << ans[0] << endl;
        if (cin.eof())
            break;
    }
    return 0;
}
