import sys 
input = sys.stdin.readline
MOD = 10**9 +7
INF = 10**9

def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(b - a)

if __name__=='__main__':
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline MOD = 10**9 +7 MOD 10**9 +7 10**9 10 9 7 INF = 10**9 INF 10**9 10 9 def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(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:
        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__':
    main() __name__=='__main__' __name__ '__main__' main() main INF = 10**9 10**9 INF input = sys.stdin.readline sys.stdin.readline input MOD = 10**9 +7 10**9 +7 MOD def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(b - a) def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(b - a) main
import sys 
input = sys.stdin.readline
MOD = 10**9 +7
INF = 10**9

def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(b - a)

if __name__=='__main__':
    main()