#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int b, c, d, e, k, deter = 0;
  int a[50];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10)
      deter += (a[i] / 10 + 1) * 10;
    else
      deter += a[i];
  }
  int min = 123 * 10;
  for (int i = 0; i < 5; i++) {
    if (deter - (10 - a[i] % 10) < min && a[i] % 10)
      min = deter - (10 - a[i] % 10);
  }
  cout << min << '\n';
  return 0;
}
