#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int a[5], sum = 0, la, la1;
  for (long long int i = 0; i < 5; i++) {
    cin >> a[i];
  };
  la = 10 - a[0] % 10;
  la1 = 0;
  for (long long int i = 1; i < 5; i++) {
    if (la <= 10 - a[i] % 10 && a[i] % 10 != 0) {
      la = 10 - a[i] % 10;
      la1 = i;
    }
  }
  for (long long int i = 0; i < 5; i++) {
    if (i != la1) {
      a[i] += 10 - (a[i] % 10);
      sum += a[i];
    }
  }
  sum += a[la1];
  cout << sum << endl;
  return 0;
}
