#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int a1, b1, c1, d1, e1;
  int a2, b2, c2, d2, e2;
  a1 = a % 10;
  b1 = b % 10;
  c1 = c % 10;
  d1 = d % 10;
  e1 = e % 10;
  a2 = a - a1;
  b2 = b - b1;
  c2 = c - c1;
  d2 = d - d1;
  e2 = e - e1;
  int k[4];
  k[0] = a1;
  k[1] = b1;
  k[2] = c1;
  k[3] = d1;
  k[4] = e1;
  int t = 0;
  int m = 100;
  for (int i = 0; i < 5; i++) {
    if (k[i] == 0) {
      t++;
    } else {
      m = min(m, k[i]);
    }
  }
  int ans;
  ans = m + 10 * (4 - t) + a2 + b2 + c2 + d2 + e2;
  cout << ans << endl;
  return 0;
}
