def main():
    A, B = map(int, input().split())
    if B % A == 0: return A+B
    else: return B- A

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

if __name__ == '__main__':
    print(main())