#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int SZ = 100;
int main() {
  vector<int> a(5);
  int small = -1;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (auto n : a) {
    if (n % 10 == 0) continue;
    if (small == -1) {
      small = n;
    } else if (small % 10 > n % 10) {
      small = n;
    }
  }
  int total = 0;
  for (auto n : a) {
    if (n % 10 == 0) {
      total += n;
    } else {
      total += (n / 10 + 1) * 10;
    }
  }
  total = total - (10 - small % 10);
  cout << total << endl;
  return 0;
}
