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

void main() {
	auto a = readln.split[0].to!int;
	auto b = readln.split[0].to!int;
	auto c = readln.split[0].to!int;
	auto d = readln.split[0].to!int;
	auto e = readln.split[0].to!int;
	
	int f(int x) {
		if (x % 10 == 0) return x;
		else return x + 10 - x%10;
	}
	
	writeln(min(
		f(a) + f(b) + f(c) + f(d) + e,
		f(a) + f(b) + f(c) + d + f(e),
		f(a) + f(b) + c + f(d) + f(e),
		f(a) + b + f(c) + f(d) + f(e),
		a + f(b) + f(c) + f(d) + f(e)
	));
	
	
}


