#import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b=map(int,input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a) from collections import deque 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 a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b
#import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b=map(int,input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a)