import sys

a, b = map(int, sys.stdin.readline().split())

def main():
    ans = a + b if not b % a else b - a
    print(ans)

if __name__ ==  '__main__':
    main() import sys sys a, b = map(int, sys.stdin.readline().split()) a map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split b def main():
    ans = a + b if not b % a else b - a
    print(ans) main ans = a + b if not b % a else b - a ans a + b if not b % a else b - a not b % a b % a b a a + b a b b - a b a print(ans) print ans if __name__ ==  '__main__':
    main() __name__ ==  '__main__' __name__ '__main__' main() main def main():
    ans = a + b if not b % a else b - a
    print(ans) def main():
    ans = a + b if not b % a else b - a
    print(ans) main a, b = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) a b = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) b
import sys

a, b = map(int, sys.stdin.readline().split())

def main():
    ans = a + b if not b % a else b - a
    print(ans)

if __name__ ==  '__main__':
    main()