#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define endl '\n'

typedef long long ll;
typedef long double lb;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W)
{ 
  return (y >= 0 && x >= 0 && y < H && x < W);
}

inline int in() {int x; cin >> x; return x;}



const ll mod = 1e9 + 7;
const ll inf = 1e9 + 9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n[10];
  int k;

  while (~scanf("%1d", &n[0])){
    for (int i = 1; i < 10; i++){
      scanf("%1d", &n[i]);
    }

    k = 9;
    for (int i = 0; i < 10; i++){
      for (int j = 0; j < k; j++){
        n[j] = (n[j] + n[j + 1]) % 10;
      }
      k--;
    }
    cout << n[0] << endl;
  }
  return (0);
}