#include<iostream>
using namespace std;
int main() {
//注意一定要声明为double,不然精度不够会计算出错
double id[2], cnt[2], e[2], sum[2];
for (int i = 0; i < 2; i ++ ) {
cin >> id[i] >> cnt[i] >> e[i];
sum[i] = cnt[i] * e[i];
}
printf("VALOR A PAGAR: R$ %.2lf", sum[0] + sum[1]);
return 0;
}