# ABC118A - B +/- A
def main():
    A, B = map(int, input().split())
    flg = B % A
    print(B - A if flg else A + B)


if __name__ == "__main__":
    main() def main():
    A, B = map(int, input().split())
    flg = B % A
    print(B - A if flg else A + B) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B flg = B % A flg B % A B A print(B - A if flg else A + B) print B - A if flg else A + B flg B - A B A A + B A B if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    A, B = map(int, input().split())
    flg = B % A
    print(B - A if flg else A + B) def main():
    A, B = map(int, input().split())
    flg = B % A
    print(B - A if flg else A + B) main
# ABC118A - B +/- A
def main():
    A, B = map(int, input().split())
    flg = B % A
    print(B - A if flg else A + B)


if __name__ == "__main__":
    main()