#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  for (int i = 0; i < 5; i++) scanf("%d", &v[i]);
  int min = 9, ind;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 != 0 and v[i] % 10 <= min) {
      min = v[i] % 10;
      ind = i;
    }
  }
  int ans = v[ind];
  v.erase(v.begin() + ind);
  for (auto i : v) {
    if (!(i % 10))
      ans += i;
    else
      ans += i + (10 - (i % 10));
  }
  printf("%d\n", (ans > 643) ? 643 : ans);
  return 0;
}
