#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> a(5);
  for (int i = 0; i < (int)(5); i++) cin >> a[i];
  int check = 10;
  int last, num;
  for (int i = 0; i < (int)(5); i++) {
    if (a[i] % 10 != 0 && a[i] % 10 < check) {
      last = a[i];
      num = i;
      check = a[i] % 10;
    }
  }
  for (int i = 0; i < (int)(5); i++) {
    if (i == num) continue;
    a[i] = a[i] + (10 - a[i] % 10) % 10;
  }
  int ans = 0;
  for (int i = 0; i < (int)(5); i++) {
    if (i == num) continue;
    ans += a[i];
  }
  ans += last;
  cout << ans << endl;
}
