#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, e, f, g;
  int d[5];
  string s, t;
  cin >> d[0] >> d[1] >> d[2] >> d[3] >> d[4];
  int ans;
  int max = 0;
  int index;
  for (int i = 0; i < 5; i++) {
    if (10 - d[i] % 10 >= max && d[i] % 10 != 0) {
      max = 10 - d[i] % 10;
      index = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i != index) {
      ans += d[i] + (10 - d[i] % 10);
      if (d[i] % 10 == 0) {
        ans -= 10;
      }
    }
  }
  cout << ans + d[index] << endl;
  return 0;
}
