# coding: utf-8

# https://atcoder.jp/contests/abc118
# 7:55-


def main():
    a, b = map(int, input().split())
    if b % a == 0:
        return a + b
    else:
        return b - a


print(main()) def main():
    a, b = map(int, input().split())
    if b % a == 0:
        return a + b
    else:
        return b - a main a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if b % a == 0:
        return a + b
    else:
        return b - a b % a == 0 b % a b a 0 return a + b a + b a b return b - a b - a b a print(main()) print main() main def main():
    a, b = map(int, input().split())
    if b % a == 0:
        return a + b
    else:
        return b - a def main():
    a, b = map(int, input().split())
    if b % a == 0:
        return a + b
    else:
        return b - a main
# coding: utf-8

# https://atcoder.jp/contests/abc118
# 7:55-


def main():
    a, b = map(int, input().split())
    if b % a == 0:
        return a + b
    else:
        return b - a


print(main())
