#include <stdio.h>
int main()
{
    int qx, px, qy, py, qz, pz;
    long total;
    
    if(scanf("%d %d", &qx, &px) !=2)
    {
        printf("Invalide input");
    return 0;
    }
    if(scanf("%d %d" ,&qy, &py) !=2) 
    {
    printf("Invalide input");
    return 0;
    }

    if(scanf("%d %d" ,&qz, &pz) !=2) 

    printf("Invalide input");
    return 0;
    }
    if (qx < 0 || px < 0 || qy < 0 || py < 0 || qz < 0 || pz < 0)
    {
    printf("Invalide input");
    return 0;
    }

   total = (qx * px) + (qy * py) + (qz * pz);
   printf("%ld", total);
   return 0;
}