def aplusb(a, b):

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

if __name__ == '__main__':
    main() def aplusb(a, b):

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

    return a+b if b%a == 0 else b-a def aplusb(a, b):

    return a+b if b%a == 0 else b-a aplusb
def aplusb(a, b):

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

if __name__ == '__main__':
    main()