import sys
from collections import deque
input = sys.stdin.readline

A, B = map(int, input().split())
if B%A == 0:
    print(A+B)
else:
    print(B-A) import sys sys from collections import deque 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 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 input = sys.stdin.readline sys.stdin.readline input A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B
import sys
from collections import deque
input = sys.stdin.readline

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