def calculate_max_multiple_less_than_1024(n):
    # Find the maximum x where x * n is a multiple of 64 and less than 1024
    x = (1024 - 1) // n  # Start with the maximum possible x
    while x > 0:
        product = x * n
        if product % 64 == 0 and product < 1024:
            return x, product
        x -= 1
    return None, None

def calculate_max_multiple_up_to_1024(n):
    # Find the maximum x where x * n is a multiple of 64 and less than or equal to 1024
    x = 1024 // n  # Start with the maximum possible x
    while x > 0:
        product = x * n
        if product % 64 == 0 and product <= 1024:
            return x, product
        x -= 1
    return None, None

# Example usage:
n = int(input("Enter the value for n: "))

x1, result1 = calculate_max_multiple_less_than_1024(n)
x2, result2 = calculate_max_multiple_up_to_1024(n)

print("\nResults for x * n < 1024:")
if x1 is not None:
    print(f"The maximum value of x where x * n is a multiple of 64 and less than 1024 is: x = {x1}")
    print(f"The product x * n = {x1} * {n} = {result1}")
else:
    print(f"No valid solution found for n = {n}")

print("\nResults for x * n <= 1024:")
if x2 is not None:
    print(f"The maximum value of x where x * n is a multiple of 64 and less than or equal to 1024 is: x = {x2}")
    print(f"The product x * n = {x2} * {n} = {result2}")
else:
    print(f"No valid solution found for n = {n}")