	#include <iostream>
	#include <algorithm>


	int main() {

		std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
		int max = -1;
		int ans = 0;
		for (int i = 0; i < 5; i++) {
			int num;
			std::cin >> num;
			int ceiled = 10 * std::ceil(num / 10.f);
			max = std::max(max, ceiled - num);
			ans += ceiled;
		}

		std::cout << ans - max;


		return 0;


	}