#include<iostream>
using namespace std;
int main() {
	char ccc[10];
	int a, b, c, d, e, f, g, h, i, j;
	int k, l, m, n, o, p, q, r, s;
	int t, u, v, w, x, y, z, aa;
	int bb, cc, dd, ee, ff, gg, hh;
	int ii, jj, kk, ll, mm, nn;
	int oo, pp, qq, rr, ss;
	int tt, uu, vv, ww;
	int xx, yy, zz;
	int an, ns;
	int ans;
	while (cin >> ccc) {
		a = (int)ccc[0] - '0';
		b = (int)ccc[1] - '0';
		c = (int)ccc[2] - '0';
		d = (int)ccc[3] - '0';
		e = (int)ccc[4] - '0';
		f = (int)ccc[5] - '0';
		g = (int)ccc[6] - '0';
		h = (int)ccc[7] - '0';
		i = (int)ccc[8] - '0';
		j = (int)ccc[9] - '0';

		k = (a + b) % 10;
		l = (b + c) % 10;
		m = (c + d) % 10;
		n = (d + e) % 10;
		o = (e + f) % 10;
		p = (f + g) % 10;
		q = (g + h) % 10;
		r = (h + i) % 10;
		s = (i + j) % 10;

		t = (k + l) % 10;
		u = (l + m) % 10;
		v = (m + n) % 10;
		w = (n + o) % 10;
		x = (o + p) % 10;
		y = (p + q) % 10;
		z = (q + r) % 10;
		aa = (r + s) % 10;

		bb = (t + u) % 10;
		cc = (u + v) % 10;
		dd = (v + w) % 10;
		ee = (w + x) % 10;
		ff = (x + y) % 10;
		gg = (y + z) % 10;
		hh = (z + aa) % 10;

		ii = (bb + cc) % 10;
		jj = (cc + dd) % 10;
		kk = (dd + ee) % 10;
		ll = (ee + ff) % 10;
		mm = (ff + gg) % 10;
		nn = (gg + hh) % 10;
		
		oo = (ii + jj) % 10;
		pp = (jj + kk) % 10;
		qq = (kk + ll) % 10;
		rr = (ll + mm) % 10;
		ss = (mm + nn) % 10;

		tt = (oo + pp) % 10;
		uu = (pp + qq) % 10;
		vv = (qq + rr) % 10;
		ww = (rr + ss) % 10;

		xx = (tt + uu) % 10;
		yy = (uu + vv) % 10;
		zz = (vv + ww) % 10;
		
		an = (xx + yy) % 10;
		ns = (yy + zz) % 10;

		ans = (an + ns) % 10;

		cout << ans << endl;
	}
}