#include <bits/stdc++.h>
int main() {
  int a = 0, b = 0, c = 0, d = 0, e = 0, at = 0, bt = 0, ct = 0, dt = 0, et = 0;
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  at = a - a / 10 * 10;
  bt = b - b / 10 * 10;
  ct = c - c / 10 * 10;
  dt = d - d / 10 * 10;
  et = e - e / 10 * 10;
  int bubble = at;
  if (bt < bubble) bubble = bt;
  if (ct < bubble) bubble = ct;
  if (dt < bubble) bubble = dt;
  if (et < bubble) bubble = et;
  printf("%d\n", a / 10 * 10 + b / 10 * 10 + c / 10 * 10 + d / 10 * 10 +
                     e / 10 * 10 + 40 + bubble);
  return 0;
}
