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