# your code goes here
def runic_numbers(size):
s = set()
for i in range(size+1):
for v in range(size+1-i):
for x in range(size+1-i-v):
l = size-i-v-x
if l>=0:
s.add(1*i+5*v+10*x+50*l)
return len(s)
for size in range(1,20):
print(size, runic_numbers(size))
print(runic_numbers(109))
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCgpkZWYgcnVuaWNfbnVtYmVycyhzaXplKToKCXMgPSBzZXQoKQoJZm9yIGkgaW4gcmFuZ2Uoc2l6ZSsxKToKCQlmb3IgdiBpbiByYW5nZShzaXplKzEtaSk6CgkJCWZvciB4IGluIHJhbmdlKHNpemUrMS1pLXYpOgoJCQkJbCA9IHNpemUtaS12LXgKCQkJCWlmIGw+PTA6CgkJCQkJcy5hZGQoMSppKzUqdisxMCp4KzUwKmwpCglyZXR1cm4gbGVuKHMpCgkKZm9yIHNpemUgaW4gcmFuZ2UoMSwyMCk6CglwcmludChzaXplLCBydW5pY19udW1iZXJzKHNpemUpKQoJCnByaW50KHJ1bmljX251bWJlcnMoMTA5KSk=