# coding: utf-8

import sys
input = sys.stdin.readline

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

ans = B % A == 0
print((A + B) if ans else (B- A))
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ans = B % A == 0 ans B % A == 0 B % A B A 0 print((A + B) if ans else (B- A)) print (A + B) if ans else (B- A) ans A + B A B B- A B A input = sys.stdin.readline sys.stdin.readline input ans = B % A == 0 B % A == 0 ans A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B
# coding: utf-8

import sys
input = sys.stdin.readline

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

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

