def main():
    a, b = get_params()
    print(answer(a, b))


def get_params():
    return map(int, input().split())


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


if __name__ == "__main__":
    main() def main():
    a, b = get_params()
    print(answer(a, b)) main a, b = get_params() a get_params() get_params b print(answer(a, b)) print answer(a, b) answer a b def get_params():
    return map(int, input().split()) get_params return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def answer(a, b):
    return a+b if b % a == 0 else b-a answer 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 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    a, b = get_params()
    print(answer(a, b)) def main():
    a, b = get_params()
    print(answer(a, b)) main def answer(a, b):
    return a+b if b % a == 0 else b-a def answer(a, b):
    return a+b if b % a == 0 else b-a answer def get_params():
    return map(int, input().split()) def get_params():
    return map(int, input().split()) get_params
def main():
    a, b = get_params()
    print(answer(a, b))


def get_params():
    return map(int, input().split())


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


if __name__ == "__main__":
    main()
