

def convert_to_length(coin: str) -> int:
    if coin == "P":
        return 1
    if coin == "N":
        return 5
    if coin == "D":
        return 10
    if coin == "Q":
        return 25
    print("ERROR: UNRECOGNIZED COINAGE")
    return -42

def is_triangle_lengths(foo: int, bar: int, phi: int) -> bool:
    return (foo+bar > phi and bar+phi > foo and phi+foo > bar)


coins = ["P","N","D","Q"]

all_combos = []
all_combos_str = []

for coin1 in coins:
    for coin2 in coins:
        for coin3 in coins:
            all_combos.append([coin1,coin2,coin3])
            all_combos_str.append(coin1+coin2+coin3)

# print(all_combos)
# print(len(all_combos))
# print(len(set(all_combos_str)))

real_triang_count = 0

for myset in all_combos:
    if is_triangle_lengths(convert_to_length(myset[0]),convert_to_length(myset[1]),convert_to_length(myset[2])):
        real_triang_count += 1

print(real_triang_count)



