#!/usr/bin/python

def main():
    A, B = [int(x) for x in input().split()]
    if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A)

def divisor(A, B):
    if B % A == 0: return True 
    return False


if __name__ == "__main__":
    main() def main():
    A, B = [int(x) for x in input().split()]
    if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A) main int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A, B = [int(x) for x in input().split()] A [int(x) for x in input().split()] B if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A) divisor(A, B) == True divisor(A, B) divisor A B True print(A + B) print A + B A B print(B - A) print B - A B A def divisor(A, B):
    if B % A == 0: return True 
    return False divisor if B % A == 0: return True 
     B % A == 0 B % A B A 0 return False False A A B B if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    A, B = [int(x) for x in input().split()]
    if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A) def main():
    A, B = [int(x) for x in input().split()]
    if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A) main def divisor(A, B):
    if B % A == 0: return True 
    return False def divisor(A, B):
    if B % A == 0: return True 
    return False divisor
#!/usr/bin/python

def main():
    A, B = [int(x) for x in input().split()]
    if divisor(A, B) == True:
        print(A + B)
    else:
        print(B - A)

def divisor(A, B):
    if B % A == 0: return True 
    return False


if __name__ == "__main__":
    main()