Problem:


Score : 100 points

Problem Statement

You are given positive integers A and B.

If A is a divisor of B, print A + B; otherwise, print B - A.

Constraints

All values in input are integers.

1 \leq A \leq B \leq 20

Input

Input is given from Standard Input in the following format:

A B

Output

If A is a divisor of B, print A + B; otherwise, print B - A.

Sample Input 1

4 12

Sample Output 1

16

As 4 is a divisor of 12, 4 + 12 = 16 should be printed.

Sample Input 2

8 20

Sample Output 2

12

Sample Input 3

1 1

Sample Output 3

2

1 is a divisor of 1.



Sample input:
4 12


Sample output:
16

Submission status: Accepted

Solution code:
def main():
    a, b = map(int, input().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

print(a+b if b%a==0 else b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:print(a+b)
else:print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

if b%a == 0:
    ans = a+b
else:
    ans = b-a

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b % a == 0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

if b%a == 0:
    print(a+b)

else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print([b-a,b+a][b%a==0])

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print([a+b,b-a][b%a!=0])

Submission status: Accepted

Solution code:
a, b= map(int, input().split())
if b % a == 0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:

str_line = input().split(" ")
num_1 = int(str_line[0])
num_2 = int(str_line[1])

if num_2%num_1 == 0:
    ans = num_1 + num_2
else:
    ans = num_2 - num_1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if(b%a==0):
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


a, b = LI()
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if(b%a==0):
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	a,b=MI()
	if b%a==0:
		ans=a+b
	else:
		ans=b-a
	print(ans)











if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b = readInts()
print(a+b if b%a == 0 else b-a)

Submission status: Accepted

Solution code:
a, b = [int(i) for i in input().split()]
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
print(a + b if b % a == 0 else b - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
if b%a==0: print(a+b)
else: print(b-a)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
print(a + b if b % a == 0 else b - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))

if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a, b = LI()
    if b % a == 0:
        print(a+b)
        return
    print(b-a)


main()

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

a,b = map(int, input().split())

if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
X = B % A

if X == 0:
    print(A + B)
else:
    print(B - A)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b%a == 0:
  print(b+a)
else:
  print(b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int,input().split())

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
print(a+b if b%a ==0 else b-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    a, b = nm()
    print(a + b if b % a == 0 else b - a)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A)




if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
[a,b]=map(int,input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
[a,b]=map(int,input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
[a, b] = map(int, input().split())
print(a + b if b % a == 0 else b - a)

Submission status: Accepted

Solution code:
[a, b] = map(int, input().split())
print(a + b if b % a == 0 else b - a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
a,b=list(map(int,input().split()))
if b%a==0:
  print(a+b)
else :
  print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split());print([b-a,a+b][b%a==0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

print(a + b) if b % a == 0 else print ( b - a)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
if b % a == 0:
  my_result = a + b
else:
  my_result = b - a
print(my_result)

Submission status: Accepted

Solution code:
ary = input().split(" ")
A = int(ary[0])
B = int(ary[1])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())

if m % n == 0:
    print(n + m)
else:
  print(m - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b%a ==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
# abc118_a.py
# https://atcoder.jp/contests/abc118/tasks/abc118_a

# A - B +/- A /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# 正整数 A,Bが与えられます。

# Aが B の約数なら A+B を、そうでなければ B−Aを出力してください。

# 制約
#     入力は全て整数である。
#     1≤A≤B≤20

# 入力
# 入力は以下の形式で標準入力から与えられる。
# A B

# 出力
# Aが B の約数なら A+B を、そうでなければ B−Aを出力せよ。

# 入力例 1
# 4 12

# 出力例 1
# 16

# 4は 12 の約数なので 4+12=16を出力します。

# 入力例 2
# 8 20

# 出力例 2
# 12

# 入力例 3
# 1 1

# 出力例 3
# 2

# 1は 1 の約数です。


def calculation(lines):
    # line = lines[0]
    # N = int(lines[0])
    A, B = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i+1]))

    if B % A == 0:
        result = A+B
    else:
        result = B-A

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4 12']
        lines_export = [16]
    if pattern == 2:
        lines_input = ['8 20']
        lines_export = [12]
    if pattern == 3:
        lines_input = ['1 1']
        lines_export = [2]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int,input().split())

if b % a == 0:
    print(int(a + b))

if b % a != 0:
    print(int(b - a))

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
num = b/a
if num.is_integer():
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0: print(a+b)
else: print(b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

b_divisor = [i for i in range(1, b+1) if b % i == 0]
#print(b_divisor)

if a in b_divisor:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

if b % a == 0:
  print(a + b)
else:
  print(b - a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b = map(int, readline().split())

    if b % a == 0:
        print(a + b)
    else:
        print(b - a)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b % a ==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

a,b = map(int, input().split())

if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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

Submission status: Accepted

Solution code:
# 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())

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b=mp()
print(a+b if b%a==0 else b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

a,b=nii()
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b = inpl()
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()
if B%A==0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

if b%a==0: print(a+b)
else: print(b-a)

Submission status: Accepted

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

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int,input().split())

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    a, b = getList()
    if (b % a) == 0:
        print(a + b)
    else:
        print(b - a)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ans = a+b
if b % a != 0:
    ans = b-a
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:
	print(a+b)
else:
	print(b-a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

if b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

if B % A:
    print(B-A)
else:
    print(A+B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
A,B = map(int,input().split())
if not ( 1 <= A <= 20 and 1 <= B <= 20 ): sys.exit()
print(A + B) if B % A == 0 else print(B - A)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if b % a ==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
print(a+b if b%a == 0 else b-a)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

if b%a == 0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

A, B = MI()

print((-1) ** int(B % A != 0) * A + B)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))

if b%a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A,B = (int(X) for X in input().split())
if B%A==0: print(B+A)
else: print(B-A)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
print(b-a if b%a else b+a)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
A,B=list(map(int,input().split()))
print(A+B if B%A==0 else B-A)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = il()
    if B % A == 0:
        print(A + B)
    else:
        print(B - A)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
rm = lambda: map(int, sys.stdin.buffer.readline().split())

a, b = rm()
print(a+b if b%a == 0 else b-a)

Submission status: Accepted

Solution code:
import sys
rm = lambda: map(int, sys.stdin.buffer.readline().split())

a, b = rm()
print(b-a if b%a else a+b)

Submission status: Accepted

Solution code:
import sys
rm = lambda: map(int, sys.stdin.buffer.readline().split())

a, b = rm()
print(b-a if b%a else a+b)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(a+b-2*a*(b%a>0))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if b%a==0:
  print(a+b)
  
else:
  print(b-a)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if b%a ==0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
4,12
a,b = map(int, raw_input().split(' '))
print a + b if (b % a == 0) else -a + b

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
A,B = (int(i) for i in input().split())
if (B/A).is_integer() :
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

if B%A == 0:
    print(A+B)

else:
    print(B-A)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(a+b if (b%a)==0 else (b-a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#A
a, b = map(int, input().split())
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

print(a+b) if b%a==0 else print(b-a)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

a, b = map(int, input().split())

if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split());print(a+b if b%a==0 else b-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
def main():
    a,b=map(int,input().split())
    if b % a == 0:
        print(a+b)
    else:
        print(b-a)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
if b%a ==0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A,  B = map(int, input().split())

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

Submission status: Accepted

Solution code:
def solve():
    a, b = map(int, input().split())
    if b % a == 0:
        print(a+b)
    else:
        print(b-a)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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