def main(A,B):
    return A + B if (B % A == 0) else B - A

A,B = map(int,input().split())
print(main(A,B)) def main(A,B):
    return A + B if (B % A == 0) else B - A main return A + B if (B % A == 0) else B - A A + B if (B % A == 0) else B - A B % A == 0 B % A B A 0 A + B A B B - A B A A A B B A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B print(main(A,B)) print main(A,B) main A B A,B = map(int,input().split()) map(int,input().split()) A B = map(int,input().split()) map(int,input().split()) B def main(A,B):
    return A + B if (B % A == 0) else B - A def main(A,B):
    return A + B if (B % A == 0) else B - A main
def main(A,B):
    return A + B if (B % A == 0) else B - A

A,B = map(int,input().split())
print(main(A,B))