import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    main() import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float('INF') INF float('INF') float 'INF' sys.setrecursionlimit(10 ** 5) sys.setrecursionlimit sys setrecursionlimit 10 ** 5 10 5 def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a) 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 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readline = sys.stdin.readline sys.stdin.readline readline INF = float('INF') float('INF') INF def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a) def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a) main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    main()
