// editor4
#include<stdio.h>
int main()
{
 int xq,xp,yq,yp,zq,zp;
 scanf("%d %d",&xq,&xp);
 scanf("%d %d",&yq,&yp);
 scanf("%d %d",&zq,&zp);
 int total - ((xq*xp)+(yq*yp)+(zq*zp));
 if(xq>0 && xp>0 && yq>0 && yp>0 && zq>0 &&zp>0){
     printf("%d", total);
 }
 else{
     printf("Invalid input");
  }
 return 0;
}