#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += 10 * (a[i] / 10);
    a[i] %= 10;
    if (a[i]) sum += 10;
  }
  sum -= 10;
  sort(a, a + 5);
  int i = 0;
  while (a[i] == 0) i++;
  cout << sum + a[i];
}
