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