import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[5]; int result=0; for (int i=0;i<5 ;i++ ) { a[i] = sc.nextInt(); } for (int j=0;j<5 ;j++ ) { if (a[j]%3==0&&a[j]%5==0) { result+=8; }else if(a[j]%3==0){ result+=4; }else if(a[j]%5==0){ result+=4; }else{ result+=a[j]; } } System.out.println(result); } }