def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
    
if __name__ == '__main__':
    main()
 def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
     main from sys import stdin r = stdin.readline()[:-1] r stdin.readline()[:-1] stdin.readline() stdin.readline stdin readline :-1 -1 a, b = map(int, r.split()) a map(int, r.split()) map int r.split() r.split r 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 def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
     def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
     main
def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
    
if __name__ == '__main__':
    main()

