//搜狐第二题,大家帮忙测下,看是否有问题
//本地测试用利{0 0 4 0 0 0   
//             7 5 1 0 0 0
//             0 0 0 0 0 0}虽然过了,但总感觉哪里不对
import java.util.ArrayList;
import java.util.Scanner;


public class Solution{
	   public static void main(String[] args) {
	        Scanner in=new Scanner(System.in);
	        ArrayList<Integer> list=new ArrayList<Integer>();	  

	         while(in.hasNext()){
	        int a[] = new int[6];
	        for(int i=0;i<6;i++)
	        a[i] = in.nextInt();
	        list.add(function(a));
	        if(function(a)==0){break;}
	        }
	        for(int i=0;i<list.size()-1;i++){
	        System.out.println(list.get(i));
	     }
	   }

	    public static int function(int [] arr){
	    	int sum=0;
        	int res=0;
	    	   for (int i=0;i<arr.length;i++){
	               sum+=Integer.valueOf(arr[i])*i*i;
	            }
	            if(sum%36>0){
	            	res=sum/36+1;
	            }else{
	            	res=sum/36;
	            }
	            return res;
	   }
}