#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int f, g, h, i, j;
  f = a / 10;
  g = b / 10;
  h = c / 10;
  i = d / 10;
  j = e / 10;
  int k, l, m, n, o;
  int p, q, r, s, t;
  if (f * 10 == a)
    k = a;
  else
    k = f * 10 + 10;
  if (g * 10 == b)
    l = b;
  else
    l = g * 10 + 10;
  if (h * 10 == c)
    m = c;
  else
    m = i * 10 + 10;
  if (i * 10 == d)
    n = d;
  else
    n = i * 10 + 10;
  if (j * 10 == e)
    o = e;
  else
    o = j * 10 + 10;
  p = a + l + m + n + o;
  q = k + b + m + n + o;
  r = k + l + c + n + o;
  s = k + l + m + d + o;
  t = k + l + m + n + e;
  if (p > q) {
    if (p > r) {
      if (p > s) {
        if (p > t)
          cout << p << endl;
        else if (p < t)
          cout << t << endl;
      } else if (s > p) {
        if (s > t)
          cout << s << endl;
        else
          cout << t << endl;
      }
    } else if (r > p) {
      if (r > s) {
        if (r > t)
          cout << r << endl;
        else
          cout << t << endl;
      } else if (s > r) {
        if (s > t)
          cout << s << endl;
        else
          cout << t << endl;
      }
    } else if (p < q) {
      if (q > r) {
        if (q > s) {
          if (q > t)
            cout << q << endl;
          else
            cout << t << endl;
        } else if (s > q) {
          if (s > t)
            cout << s << endl;
          else
            cout << t << endl;
        }
      } else if (q < r) {
        if (r > s) {
          if (r > t)
            cout << r << endl;
          else
            cout << t << endl;
        } else if (s > r) {
          if (s > t)
            cout << s << endl;
          else
            cout << t << endl;
        }
      }
    }
  }
}
