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