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