# -*- coding: utf-8 -*-
"""
A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

"""
import sys


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


if __name__ == '__main__':
    main(sys.argv[1:]) """
A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

""" import sys sys def main(args):
    A, B = map(int, input().split())
    ans = A + B if B % A == 0 else B - A
    print(ans) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ans = A + B if B % A == 0 else B - A ans 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 print(ans) print ans args args if __name__ == '__main__':
    main(sys.argv[1:]) __name__ == '__main__' __name__ '__main__' main(sys.argv[1:]) main sys.argv[1:] sys.argv sys argv 1: 1 def main(args):
    A, B = map(int, input().split())
    ans = A + B if B % A == 0 else B - A
    print(ans) def main(args):
    A, B = map(int, input().split())
    ans = A + B if B % A == 0 else B - A
    print(ans) main
# -*- coding: utf-8 -*-
"""
A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

"""
import sys


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


if __name__ == '__main__':
    main(sys.argv[1:])
