#include <stdio.h>

int main() {
    int quantityX, priceX;
    int quantityY, priceY;
    int quantityZ, priceZ;
    long long totalCost;
    
    if (scanf("%d %d", &quantityX, &priceX) != 2) {
        printf("Invalid input\n");
        return 1;
    }
    
    if (scanf("%d %d", &quantityY, &priceY) != 2) {
        printf("Invalid input\n");
        return 1;
    }
    
    if (scanf("%d %d", &quantityZ, &priceZ) != 2) {
        printf("Invalid input\n");
        return 1;
    }
    
    if (quantityX < 0 || priceX < 0 ||
        quantityY < 0 || priceY < 0 ||
        quantityZ < 0 || priceZ < 0) {
        printf("Invalid input\n");
        return 0;
    }
    
    totalcost = (long long)quantityX * priceX + 
                (long long)quantityY * priceY +
                (long long)quantityZ * priceZ;
    
    printf("%11d\n", totalCost);
    
    return 0;
}