p1 = list(input().split()) p2 = list(input().split()) print("VALOR A PAGAR: R$",f'{eval(p1[1])*eval(p1[2])+eval(p2[1])*eval(p2[2]):.2f}')