def sub():
    A, B = [int(e) for e in input().split()]
    q, m = divmod(B, A)
    if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A)

sub() def sub():
    A, B = [int(e) for e in input().split()]
    q, m = divmod(B, A)
    if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A) sub int(e) for e in input().split() for e in input().split() e input().split() ().split () input split for e in input().split() int(e) int e A, B = [int(e) for e in input().split()] A [int(e) for e in input().split()] B q, m = divmod(B, A) q divmod(B, A) divmod B A m if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A) q > 0 and m == 0 q > 0 q 0 m == 0 m 0 print(A+B) print A+B A B print(B-A) print B-A B A sub() sub def sub():
    A, B = [int(e) for e in input().split()]
    q, m = divmod(B, A)
    if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A) def sub():
    A, B = [int(e) for e in input().split()]
    q, m = divmod(B, A)
    if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A) sub
def sub():
    A, B = [int(e) for e in input().split()]
    q, m = divmod(B, A)
    if q > 0 and m == 0:
        print(A+B)
    else:
        print(B-A)

sub()
