#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  int k = 0;
  int h = 0;
  int b[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    int x = a[i];
    int m = 0;
    for (;;) {
      x++;
      m++;
      if (x % 10 == 0) {
        if (h < m) {
          h = m;
          k = i;
        }
        b[i] = x;
        break;
      }
    }
  }
  cout << b[0] + b[1] + b[3] + b[4] + b[2] - h << endl;
}
