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