#include <bits/stdc++.h>
using namespace std;
int main() {
  int A;
  cin >> A;
  int B;
  cin >> B;
  int C;
  cin >> C;
  int D;
  cin >> D;
  int E;
  cin >> E;
  int a = A % 10;
  if (a == 0) a = 10;
  int b = B % 10;
  if (b == 0) b = 10;
  int c = C % 10;
  if (c == 0) c = 10;
  int d = D % 10;
  if (d == 0) d = 10;
  int e = E % 10;
  if (e == 0) e = 10;
  int z = (A / 10) * 10 + 10;
  if (a == 10) z--;
  int y = (B / 10) * 10 + 10;
  if (b == 10) y--;
  int x = (C / 10) * 10 + 10;
  if (c == 10) x--;
  int v = (D / 10) * 10 + 10;
  if (d == 10) v--;
  int u = (E / 10) * 10 + 10;
  if (e == 10) u--;
  int ans = 0;
  if (a <= b && a <= c && a <= d && a <= e)
    ans = A + y + x + v + u;
  else if (b <= a && b <= c && b <= d && b <= e)
    ans = B + z + x + v + u;
  else if (c <= a && c <= b && c <= d && c <= e)
    ans = C + z + y + v + u;
  else if (d <= a && d <= b && d <= c && d <= e)
    ans = D + z + y + x + u;
  else if (e <= a && e <= b && e <= c && e <= d)
    ans = E + z + y + x + v;
  cout << ans << endl;
}
