#!python3



def resolve():

    A, B = list(map(int, input().rstrip().split(" ")))



    a = b = 2

    X = A

    Y = B

    while True:

        if X == Y:

            break

        elif X < Y:

            X += A

        else:

            Y += B



    print(X)



if __name__ == "__main__":

    resolve()

#!python3



def factor(n):

    ans = []

    i = 0

    while n & 1 == 0:

        n >>= 1

        i += 1



    if i > 0:

        ans.append((2, i))



    for i in range(3, int(n**.5) +1, 2):

        x, y = divmod(n, i)



        if y == 0:

            j = 1

            x1 = x

            while True:

                x1, y = divmod(x, i)

                if y == 0:

                    x = x1

                    j += 1

                else:

                    ans.append((i, j))

                    break

            n = x



    if n > 1:

        ans.append((n, 1))



    return ans



def resolve():

    A, B = list(map(int, input().rstrip().split(" ")))



    fa = dict(factor(A))

    fb = dict(factor(B))





    a = A

    for k, v in list(fa.items()):

        if k in fb:

            v2 = fb[k]

            if v < v2:

                a *= k ** (v2 - v)

            del fb[k]

    for k, v in list(fb.items()):

        a *= k ** v



    print(a)



if __name__ == "__main__":

    resolve()

#!python3
def resolve():
    A, B = list(map(int, input().rstrip().split(" ")))
    a = b = 2
    X = A
    Y = B
    while True:
        if X == Y:
            break
        elif X < Y:
            X += A
        else:
            Y += B
    print(X)


if __name__ == "__main__":
    resolve()

#!python3
def factor(n):
    ans = []
    i = 0
    while n & 1 == 0:
        n >>= 1
        i += 1
    if i > 0:
        ans.append((2, i))
    for i in range(3, int(n**0.5) + 1, 2):
        x, y = divmod(n, i)
        if y == 0:
            j = 1
            x1 = x
            while True:
                x1, y = divmod(x, i)
                if y == 0:
                    x = x1
                    j += 1
                else:
                    ans.append((i, j))
                    break
            n = x
    if n > 1:
        ans.append((n, 1))
    return ans


def resolve():
    A, B = list(map(int, input().rstrip().split(" ")))
    fa = dict(factor(A))
    fb = dict(factor(B))
    a = A
    for k, v in list(fa.items()):
        if k in fb:
            v2 = fb[k]
            if v < v2:
                a *= k ** (v2 - v)
            del fb[k]
    for k, v in list(fb.items()):
        a *= k**v
    print(a)


if __name__ == "__main__":
    resolve()

+def factor(n): +    ans = [] +    i = 0 +    while n & 1 == 0: +        n >>= 1 +        i += 1 +    if i > 0: +        ans.append((2, i)) +    for i in range(3, int(n**0.5) + 1, 2): +        x, y = divmod(n, i) +        if y == 0: +            j = 1 +            x1 = x +            while True: +                x1, y = divmod(x, i) +                if y == 0: +                    x = x1 +                    j += 1 +                else: +                    ans.append((i, j)) +                    break +            n = x +    if n > 1: +        ans.append((n, 1)) +    return ans + + -    a = b = 2 -    X = A -    Y = B -    while True: -        if X == Y: -            break -        elif X < Y: -            X += A -        else: -            Y += B -    print(X) +    fa = dict(factor(A)) +    fb = dict(factor(B)) +    a = A +    for k, v in list(fa.items()): +        if k in fb: +            v2 = fb[k] +            if v < v2: +                a *= k ** (v2 - v) +            del fb[k] +    for k, v in list(fb.items()): +        a *= k**v +    print(a)