<include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
    string fuelType;
    double quantity price;
    
    if (!(cin >> fuelType >> quantity >> price)) {
        cout << "Invalid input" << endl;
        return 0;
    }
    if ((fuelType == "petrol" || fuelType =="diesel") && quantity > 0 && price > 0) {
        double totalCost = quantity * price;
        cout << fixed << setprecision(2) << totalCost << endl;
        
    }else{
        cout << "Invalid input" << endl;
    }
    return 0;
}