def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    slove() def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    if b % a == 0:
        print(a + b)
    else:
        print(b - a) slove import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline a, b = list(map(int, input().rstrip('\n').split())) a list(map(int, input().rstrip('\n').split())) list map(int, input().rstrip('\n').split()) map int input().rstrip('\n').split() ().rstrip('\n').split ().rstrip('\n') ().rstrip () input rstrip '\n' 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 if __name__ == '__main__':
    slove() __name__ == '__main__' __name__ '__main__' slove() slove def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    if b % a == 0:
        print(a + b)
    else:
        print(b - a) def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    if b % a == 0:
        print(a + b)
    else:
        print(b - a) slove
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    slove()
