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