void main() {
    int[] a = new int[5], b = new int[5];
    foreach (i; 0 .. 5) {
        int tmp = readln.chomp.to!int - 1;
        a[i] = tmp / 10 * 10, b[i] = tmp % 10 + 1;
    }
    zip(b, a).sort!((t1, t2) => t1[0] > t2[0]);
    int time;
    foreach (i; 0 .. 5) {
        if (i == 4) {
            time += a[i] + b[i];
        } else {
            time += a[i] + 10;
        }
    }
    time.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.container;
import std.typecons;