#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, a[5];
  k = 0;
  for (i = 0; i < 5; i++) {
    cin >> a[i];
    k += a[i] - a[i] % 10;
    a[i] %= 10;
  }
  sort(a, a + 5);
  for (i = 4; i > 0; i++) {
    k += a[i];
    j = (k - 1) / 10 + 1;
    k = j * 10;
  }
  cout << k + a[0];
}
