import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

main() import sys sys from bisect import * from heapq import * from collections import * from itertools import * from functools import * from math import * from fractions import * sys.setrecursionlimit(100000000) sys.setrecursionlimit sys setrecursionlimit 100000000 input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def main():
    A, B = map(int, input().split())
    print(A + B if B % A == 0 else B - A) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B print(A + B if B % A == 0 else B - A) print A + B if B % A == 0 else B - A B % A == 0 B % A B A 0 A + B A B B - A B A main() main input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def main():
    A, B = map(int, input().split())
    print(A + B if B % A == 0 else B - A) def main():
    A, B = map(int, input().split())
    print(A + B if B % A == 0 else B - A) main
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

main()
