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.

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramA a = new ProgramA();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');

            if (int.Parse(s[1]) % int.Parse(s[0]) == 0)
                Console.WriteLine(int.Parse(s[1]) + int.Parse(s[0]));
            else
                Console.WriteLine(int.Parse(s[1]) - int.Parse(s[0]));

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int[] count = new int[m];

            for (int i = 0; i < n; i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                for(int j = 0;j < int.Parse(t[0]);j++)
                {
                    count[int.Parse(t[j + 1]) - 1]++;
                }

            }

            int ans = 0;
            for(int i = 0;i < m;i++)
            {
                if (count[i] == n)
                    ans++;
            }

            Console.WriteLine(ans);
        }

        
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');

            //最大公約数を求める
            long temp = gcd(long.Parse(s[0]), long.Parse(s[1]));
            for(int i = 2;i < s.Length;i++)
            {
                temp = gcd(temp, long.Parse(s[i]));
                
            }

            //答え出力
            Console.WriteLine(temp);

        }

        /*最大公約数を求める関数*/
        static long gcd(long p, long q)
        {
            if (p < q)
            {
                long temp = p;
                p = q;
                q = temp;
            }

            long r = 1;

            while (r != 0)
            {
                r = p % q;
                p = q;
                q = r;
            }

            return p;
        }
    }



    class ProgramD
    {
        public void main()
        {

            //入力
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long m = long.Parse(s[1]);
            string[] t = Console.ReadLine().Split(' ');
            int[] num = {2,5,5,4,5,6,3,7,6};
            int[] dp = new int[n + 1];
            int INF = -10000000;

            //動的計画で最大桁数を出す
            for (int i = 1; i <= n; i++)
                dp[i] = INF;

            dp[0] = 0;//初項
            for (int i = 0;i <= n;i++)
            {
                if (dp[i] == INF)
                    continue;
                for (int j = 0; j < m; j++)
                {
                    if(i + num[int.Parse(t[j])- 1] <= n)
                        dp[i + num[int.Parse(t[j]) - 1]] = Math.Max(dp[i + num[int.Parse(t[j]) - 1]], dp[i] + 1);
                }
            }

            int pos = (int)n;//位置記録
            //桁数分逆算して答え出力
            for(int i = 0;i < dp[n];i++)
            {

                int max = 0;
                int sub = 0;

                //一つ前の中で一番大きいものに移動する
                for (int j = 0; j < m; j++)
                {
                    if (pos - num[int.Parse(t[j]) - 1] >= 0)
                    {
                        if (dp[pos - num[int.Parse(t[j]) - 1]] == dp[pos] - 1)
                        {
                            if (max < int.Parse(t[j]))
                            {
                                max = int.Parse(t[j]);
                                sub = num[int.Parse(t[j]) - 1];
                            }
                        }
                    }
                }

                //最大値の出力して、位置を移動
                Console.Write(max);
                pos -= sub;

            }

        }
    }

   
}