#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e, time, cnt, tmp;
  std::cin >> a;
  std::cin >> b;
  std::cin >> c;
  std::cin >> d;
  std::cin >> e;
  time = 0;
  int dis1, dis2, dis3, dis4, dis5;
  if (a % 10 != 0) {
    dis1 = (a % 10);
    cnt = dis1;
    tmp = a;
  } else {
    time += a;
    dis1 = 0;
    cnt = 10;
  }
  if (b % 10 != 0) {
    dis2 = (b % 10);
    if (dis2 < cnt) {
      cnt = dis2;
      a = a + (10 - dis1);
      time += a;
      tmp = b;
    } else {
      b = b + (10 - dis2);
      time += b;
    }
  } else {
    time += b;
    dis2 = 0;
  }
  if (c % 10 != 0) {
    dis3 = (c % 10);
    if (dis3 < cnt) {
      cnt = dis3;
      b = b + (10 - dis2);
      time += b;
      tmp = c;
    } else {
      c = c + (10 - dis3);
      time += c;
    }
  } else {
    time += c;
    dis3 = 0;
  }
  if (d % 10 != 0) {
    dis4 = (d % 10);
    if (dis4 < cnt) {
      cnt = dis4;
      c = c + (10 - dis3);
      time += c;
      tmp = d;
    } else {
      d = d + (10 - dis4);
      time += d;
    }
  } else {
    time += d;
    dis4 = 0;
  }
  if (e % 10 != 0) {
    dis5 = (e % 10);
    if (dis5 < cnt) {
      cnt = dis5;
      d = d + (10 - dis4);
      time += d;
      tmp = e;
    } else {
      e = e + (10 - dis5);
      time += e;
    }
  } else {
    time += e;
    dis5 = 0;
  }
  time += tmp;
  std::cout << time << std::endl;
  return 0;
}
