#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int maxtime(int x) {
	// Maximum consuming time for x-minute order
	return (x + 9) / 10 * 10;
}
int remtime(int x) {
	// Remained time for x-minute order
	return maxtime(x) - x;
}

int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;

	int sum = maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e);
	sum -= max({ remtime(a), remtime(b), remtime(c), remtime(d), remtime(e) });
  cout << ans << endl;
  return 0;
}