# Jacket Potato Calculator

def main():
    choice = input("(M) for medium and (L) for large sized jackets: ")
    toppings = int(input("Number of toppings: "))
    result = jacketPotatoCalculator(choice, toppings)
    print(result)
    
def jacketPotatoCalculator(size, toppings):
    cost = 0
    MEDIUM = 2.50
    LARGE = 3.50
    MEDIUM_UP_TO_2 = 0.50
    MEDIUM_THREE_OR_MORE = 0.40
    LARGE_UP_TO_2 = 0.55
    LARGE_THREE_OR_MORE = 0.45
    
    if (size == "M"):
        cost = MEDIUM
        if (toppings <= 2):
            cost = cost + (toppings * MEDIUM_UP_TO_2)
        else:
            cost = cost + (toppings * MEDIUM_THREE_OR_MORE)
    else:
        cost = LARGE
        if (toppings <= 2):
            cost = cost + (toppings * LARGE_UP_TO_2)
        else:
            cost = cost + (toppings * LARGE_THREE_OR_MORE)
    output = "Total cost %0.2f" % cost + " pounds"
    return output
    
main()
