from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if (B%A==0):
  print(A+B)
else:
  print(B-A) from sys import stdin int(x) for x in stdin.readline().rstrip().split() for x in stdin.readline().rstrip().split() x stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split for x in stdin.readline().rstrip().split() int(x) int x A, B = [int(x) for x in stdin.readline().rstrip().split()] A [int(x) for x in stdin.readline().rstrip().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 = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] A B = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] B
from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if (B%A==0):
  print(A+B)
else:
  print(B-A)
