def is_limited_factor_number(x):
    if x <= 0:
        return False

    for factor in [2, 3, 5]:
        while x % factor == 0:
            x //= factor
    
    return x == 1
inputs = [6, 1, 14, 30, 7]
for x in inputs:
    result = is_limited_factor_number(x)
    print(f"Input: {x}, Output: {result}")
