#include <iostream>

struct operacion {
   std::string tipo;
   unsigned cantidad;
   double precio;
   double total;
};

operacion* registrar_operacion();

int main(void) {
    operacion *o = registrar_operacion();
    if (o == nullptr) return -1;
    std::cout << o->total << std::endl;
    return 0;
}

operacion* registrar_operacion() {
    operacion *o = new operacion;
    std::cin >> o->tipo >> o->cantidad >> o->precio;
    if (o->tipo == "venta") o->total = o->cantidad * o->precio;
    else if (o->tipo == "compra") o->total = o->cantidad * o->precio * -1.0;
    else {
       delete o;
       return nullptr;
    }
    return o;
}

