import sys
input = sys.stdin.readline

N, M = map(int,input().split())
if M%N==0:
    print(M+N)
else:
    print(M-N) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M if M%N==0:
    print(M+N)
else:
    print(M-N) M%N==0 M%N M N 0 print(M+N) print M+N M N print(M-N) print M-N M N M = map(int,input().split()) map(int,input().split()) M N, M = map(int,input().split()) map(int,input().split()) N input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline

N, M = map(int,input().split())
if M%N==0:
    print(M+N)
else:
    print(M-N)