import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	} main {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] x = new int[5]; x new int[5] 5 int[] y = new int[5]; y new int[5] 5 int total=0; total 0 int miny=10; miny 10 for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		} {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc y[i] = x[i]%10 y[i] y i x[i]%10 x[i] x i 10 total += x[i] - y[i] total x[i] - y[i] x[i] x i y[i] y i if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			} y[i]>0 y[i] y i 0 {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			} if(y[i]<miny) {
					miny = y[i];
				} y[i]<miny y[i] y i miny {
					miny = y[i];
				} miny = y[i] miny y[i] y i y[i] = 10 y[i] y i 10 for (int i=0;i<5;i++) {
			total += y[i];
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			total += y[i];
		} {
			total += y[i];
		} total += y[i] total y[i] y i System.out.println(miny==10 ? total : total+miny-10) System.out.println System.out System System.out miny==10 ? total : total+miny-10 miny==10 miny 10 total total+miny-10 total+miny total miny 10 String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] x = new int[5];
		int[] y = new int[5];

		int total=0;
		int miny=10;
		for (int i=0;i<5;i++) {
			x[i] = sc.nextInt();
			y[i] = x[i]%10;
			total += x[i] - y[i];
			if(y[i]>0) {
				if(y[i]<miny) {
					miny = y[i];
				}
				y[i] = 10;
			}
		}

		for (int i=0;i<5;i++) {
			total += y[i];
		}

		System.out.println(miny==10 ? total : total+miny-10);

	}
}