#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
ll a,b,c,d,e;
cin >> a >> b >> c >> d >> e;
ll f, g, h, i,j;
f = (a + 9) / 10 * 10;
g = (b + 9) / 10 * 10;
h = (c + 9) / 10 * 10;
i = (d + 9) / 10 * 10;
j = (e + 9) / 10 * 10;
ll ans = f + g + h + i + j;
ans -= ({f - a, g - b, h - c, i - d, j - e});
cout << ans << endl;
}
