#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  vector<int> a(5);
  for (int i = 0; i < (int)(5); i++) {
    cin >> a[i];
  }
  int min = 10;
  int sum = 0;
  for (int i = 0; i < (int)(5); i++) {
    int lowest = a[i] % 10;
    if (lowest < min) {
      min = lowest;
    }
    int tmp = (lowest == 0 ? a[i] : ((a[i] / 10 + 1) * 10));
    sum += tmp;
  }
  sum -= (10 - min);
  cout << sum << endl;
}
