#include<stdio.h>
int main()
{
    int q1,p1;
    int q2,p2;
    int q3,p3;
    int t;
    scanf("%d %d",&q1,&p1);
    scanf("%d %d",&q2,&p2);
    scanf("%d %d",&q3,&p3);
    if (q1<0 || q2<0 || q3<0 || pl<0 || p2<0 || p3<0)
       printf("Invalid Input");
    else
    {
        t=(q1 * p1)+(q2 * p2)+(q3 * p3);
        printf("%d",t);
    }
    return 0;
    
}