import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main() import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 INF=10**18 INF 10**18 10 18 MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def main():
    A,B=map(int,input().split())
    if B%A==0:
        print(A+B)
    else:
        print(B-A) main A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B if B%A==0:
        print(A+B)
    else:
        print(B-A) B%A==0 B%A B A 0 print(A+B) print A+B A B print(B-A) print B-A B A if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main MOD=10**9+7 10**9+7 MOD def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input INF=10**18 10**18 INF def main():
    A,B=map(int,input().split())
    if B%A==0:
        print(A+B)
    else:
        print(B-A) def main():
    A,B=map(int,input().split())
    if B%A==0:
        print(A+B)
    else:
        print(B-A) main
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()
