# 시간초과 뜸
import time
start = time.time()
n = int(input())
ugly_numbers = [1]

count = 1
number = 1
while True:
    if count == n:
        break
    number += 1
    for i in [2, 3, 5]:
        if number % i == 0 and number // i in ugly_numbers:
            ugly_numbers.append(number)
            count += 1
            break
    
print(number)
print(time.time()-start)





34b6f9715141f187f10e41a1a2c8a37de302ae91
<mask token>

<mask token>
while True:
    if count == n:
        break
    number += 1
    for i in [2, 3, 5]:
        if number % i == 0 and number // i in ugly_numbers:
            ugly_numbers.append(number)
            count += 1
            break
print(number)
print(time.time() - start)

<mask token>
start = time.time()
n = int(input())
ugly_numbers = [1]
count = 1
number = 1
while True:
    if count == n:
        break
    number += 1
    for i in [2, 3, 5]:
        if number % i == 0 and number // i in ugly_numbers:
            ugly_numbers.append(number)
            count += 1
            break
print(number)
print(time.time() - start)

import time
start = time.time()
n = int(input())
ugly_numbers = [1]
count = 1
number = 1
while True:
    if count == n:
        break
    number += 1
    for i in [2, 3, 5]:
        if number % i == 0 and number // i in ugly_numbers:
            ugly_numbers.append(number)
            count += 1
            break
print(number)
print(time.time() - start)

# 시간초과 뜸
import time
start = time.time()
n = int(input())
ugly_numbers = [1]

count = 1
number = 1
while True:
    if count == n:
        break
    number += 1
    for i in [2, 3, 5]:
        if number % i == 0 and number // i in ugly_numbers:
            ugly_numbers.append(number)
            count += 1
            break
    
print(number)
print(time.time()-start)




