#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int number1, x1, number2,x2;
double total;
double y1,y2;
cin >> number1 >> x1 >> y1;
cin >> number2 >> x2 >> y2;
total = x1 * y1 + x2 * y2;
printf("VALOR A PAGAR: R$ %.2lf",total);
return 0;
}