#include <cstdio> int n1,n2,s1,s2; double p1,p2; int main(){ scanf("%d%d%lf",&n1,&s1,&p1); scanf("%d%d%lf",&n2,&s2,&p2); printf("VALOR A PAGAR: R$ %.2lf",s1*p1+s2*p2); return 0; }