from fractions import gcd
A, B = map(int, input().split())
if gcd(A, B) == A:
    print(A + B)
else:
    print(B-A) from fractions import gcd A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if gcd(A, B) == A:
    print(A + B)
else:
    print(B-A) gcd(A, B) == A gcd(A, B) gcd A B A print(A + B) print A + B A B print(B-A) print B-A B A A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B
from fractions import gcd
A, B = map(int, input().split())
if gcd(A, B) == A:
    print(A + B)
else:
    print(B-A)
