if __name__ == "__main__":
    A, B = [int(s) for s in input().split()]

    if B % A == 0:
        print(A + B)
    else:
        print(B - A) if __name__ == "__main__":
    A, B = [int(s) for s in input().split()]

    if B % A == 0:
        print(A + B)
    else:
        print(B - A) __name__ == "__main__" __name__ "__main__" int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s A, B = [int(s) for s in input().split()] A [int(s) for s in input().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 A, B = [int(s) for s in input().split()] [int(s) for s in input().split()] A B = [int(s) for s in input().split()] [int(s) for s in input().split()] B
if __name__ == "__main__":
    A, B = [int(s) for s in input().split()]

    if B % A == 0:
        print(A + B)
    else:
        print(B - A)
