#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], menor[5], base, resp = 0, aux = -1;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  base = 9;
  for (int i = 0; i < 5; i++) {
    menor[i] = a[i] % 10;
    if (base > menor[i] && menor[i] != 0) {
      base = menor[i];
      aux = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (menor[i] == 0) {
      resp += a[i];
    } else {
      resp += a[i] + (10 - menor[i]);
    }
  }
  if (aux == -1) {
    resp = resp;
  } else {
    resp = resp - (10 - menor[aux]);
  }
  cout << resp << endl;
  return 0;
}
