#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int a[5] = {};
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int aaaa = a[0] + a[1] + a[2] + a[3] + a[4];
  for (long long i = 0; i < (long long)(5); i++) {
    a[i] = (a[i] / 10) * 10 + 10 - a[i];
  }
  sort(a, a + 5, greater<int>());
  cout << aaaa + a[1] + a[2] + a[3] + a[4] << endl;
  return 0;
}
