#include <stdio.h>

int main() {
    int qtyX, priceX;
    int qtyY, priceY;
    int qtyZ, pricez;
    long total;
    
    
    scanf("%d %d", &qtyX, &priceX);
    scanf("%d %d", &qtyY, &priceY);
    scanf("%d %d", &qtyZ, &priceZ);
    
    
    if (qtyX < 0 || priceX < 0 ||
        qtyY < 0 || priceY < 0 ||
        qtyZ < 0 || priceZ < 0) {
            printf("Invalid input\n");
            return 0;
        }
        
        
        total = qtyX * priceX + qtyY * priceY + qtyZ * priceZ
        printf("%1d\n", total);
        
        return 0;
}