#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
using namespace std;

int maxtime(int x) {
	return (x + 9) / 10 * 10;
}
int retime(int x) {
	return maxtime(x) - x;
}

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e ;
	int A = maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e);
	int B = A - max(retime(a), retime(b), retime(c), retime(d), retime(e));
	cout << B << endl;
}