#include<bits/stdc++.h> using namespace std; int main(){ int x, n; double p, s = 0; for(int i = 1; i <= 2; i++){ cin >> x >> n >> p, s += n * p; } printf("VALOR A PAGAR: R$ %.2lf", s); return 0; }