#include<iostream>
using namespace std;

int main() {
    string type;
    int books;
    
    cin >> type >> books;
    
    if((type != "student" && type != "faculty") || books < 0) || books > 50) {
        cout << "Invalid input";
        return 0;
    }
    int fee;
    
    if(type == "student")
    fee = books * 5;
    else
    fee = books * 10;
    
    cout << "$" << fee;
    
    return 0;
}