#include <bits/stdc++.h>
using namespace std;

int a[5];
int ttl = 0;
int main() {
  for (int i = 0; i < 5; i++) cin >> a[i], ttl += (a[i] + 9) / 10 * 10;
  int mn = 11;
  for (int i = 0; i < 5; i++) mn = min(mn, a[i] % 10 + (a[i] % 10 == 0 ? 10 : 0));
  ttl -= (10 - mn);
  cout << ttl << endl;
}