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