// editor4
#include<stdio.h>
void main()
{
    int qx,qy,qz,px,py,pz,tot;
    scanf("%d\n%d\n%d\n",&qx,&qy,&qz);
    scanf("%d\n%d\n%d\n",&px,&py,&pz);
    (qx+qy+qz)*(px+py+pz)=tot;
    if(tot<=0)
    {
        printf("%d",tot);
    }
    else if(qx<0&&qy<0&&qz<0)
    {
        printf("Invalid Input");
    }
}