#include <bits/stdc++.h>
using namespace std;
int main() {
  int time[5], a[5], t[5], wait = 10, wait_x, result = 0;
  for (int i = 0; i < 5; i++) {
    cin >> time[i];
    a[i] = time[i] % 10;
    if (a[i] > 0) t[i] = time[i] + 10 - a[i];
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] > 0 && a[i] < wait) {
      wait = a[i];
      wait_x = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (wait_x == i)
      result += time[i];
    else
      result += t[i];
  }
  cout << result << endl;
  return 0;
}
