#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], b[5];
  for (int i; i < 5; ++i) cin >> a[i];
  for (int i; i < 5; ++i) {
    b[i] = a[i] % 10;
  }
  int c[5];
  for (int i; i < 5; ++i) {
    if (b[i] != 0)
      c[i] = a[i] - b[i] + 10;
    else
      c[i] = a[i];
  }
  for (int i; i < 5; ++i) {
    if (b[i] == 0) b[i] = 9;
  }
  b[0] = min({b[0], b[1], b[2], b[3], b[4]});
  int ans = c[0] + c[1] + c[2] + c[3] + c[4] - 10 + b[0];
  cout << ans << endl;
}
