#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e;
vector<int> v(5, 0);
int main() {
  for (int i = 0; i < 5; i++) cin >> v[i];
  int last_index = 0;
  for (int i = 0; i < 5; i++) {
    if (v[last_index] % 10 > v[i] % 10 && v[i] % 10 != 0) last_index = i;
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    int tmp = ((int)(v[i] / 10) + 1) * 10;
    if (v[i] % 10 == 0) tmp = v[i];
    ans += tmp;
  }
  ans -= ((int)(v[last_index] / 10) + 1) * 10 - v[last_index];
  cout << ans << endl;
}
