import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)

    return


if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 MOD = 1000000007 MOD 1000000007 def main():
    A, B = map(int, readline().split())

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)

    return main A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline 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 return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readline = sys.stdin.readline sys.stdin.readline readline read = sys.stdin.read sys.stdin.read read INF = 1 << 60 1 << 60 INF MOD = 1000000007 1000000007 MOD readlines = sys.stdin.readlines sys.stdin.readlines readlines def main():
    A, B = map(int, readline().split())

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)

    return def main():
    A, B = map(int, readline().split())

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)

    return main
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)

    return


if __name__ == '__main__':
    main()
