#include <bits/stdc++.h>
using namespace std;
int main() {
  int t[5], off[5], k = 0;
  while (k < 5) {
    cin >> t[k];
    off[k] = 10 - t[k] % 10;
    k++;
  }
  int i, j, tmp = 0, tm = 0;
  for (i = 0; i < 5; i++) {
    int c = i;
    for (j = i; j < 5; j++) {
      if (off[c] > off[j]) {
        c = j;
      }
    }
    tmp = off[c];
    off[c] = off[i];
    off[i] = tmp;
    tm = t[c];
    t[c] = t[i];
    t[i] = tm;
  }
  int l = 0, ans = 0;
  while (l < 4) {
    ans = ans + off[l] + t[l];
    l++;
  }
  ans += t[4];
  cout << ans << endl;
  return 0;
}
