# -*- coding: utf-8 -*-
"""
Created on Mon May  4 20:55:48 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
A, B = map(int,input().split())

if B % A == 0:
    print(A+B)
else:
    print(B-A)
 """
Created on Mon May  4 20:55:48 2020
""" import sys sys sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 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 mod = 10**9+7 10**9+7 mod B = map(int,input().split()) map(int,input().split()) B A, B = map(int,input().split()) map(int,input().split()) A
# -*- coding: utf-8 -*-
"""
Created on Mon May  4 20:55:48 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
A, B = map(int,input().split())

if B % A == 0:
    print(A+B)
else:
    print(B-A)

