Загрузка данных


'''
print('w x y z')
for w in range(2):
    for x in range(2):
        for y in range(2):
            for z in range(2):
                if (not((x <= w) <= (w == z))and y)==1:
                    print(w,x,y,z)

print('w x y z')
for w in range(2):
    for x in range(2):
        for y in range(2):
            for z in range(2):
                if (((z <= x) <= (x==y)) or (not(w)))==0:
                    print(w,x,y,z)

def f(n):
    r = ''
    while n > 0:
        r = str(n%3)+r
        n = n // 3
    return r
t = []
for n in range(1, 1000):
    r = f(n)
    if n%3==0:
        r = '1'+r+'21'
    else:
        r = r+f(n%3*5)
    r = int(r,3)
    if r<=1130:
        t.append(n)
print(t)

from itertools import product
k = 0
t=[]
for x in product('вилмос',repeat=5):
    m = ''.join(x)
    k+=1
    if k%2!=0 and m[0]!='о' and m[0]!='с' and m.count('в')==1 and m.count('с')<=1:
        t.append(k)
print(max(t))
'''
from itertools import product
k = 0
for x in product('аеилнопц',repeat=5):
    m = ''.join(x)
    k+=1
    if k%2!=0 and m[0]!='а' and m[-1]!='а' and m.count('л')>=3:
        print(k)