Problem:
Handsel

Alice and Brown are brothers in a family and each receives pocket money in celebration of the coming year. They are very close and share the total amount of the money fifty-fifty. The pocket money each receives is a multiple of 1,000 yen.

Write a program to calculate each one’s share given the amount of money Alice and Brown received.

Input

The input is given in the following format.

a b

A line of data is given that contains two values of money: a (1000 ≤ a ≤ 50000) for Alice and b (1000 ≤ b ≤ 50000) for Brown.

Output

Output the amount of money each of Alice and Brown receive in a line.

Sample Input 1

1000 3000

Sample Output 1

2000

Sample Input 2

5000 5000

Sample Output 2

5000

Sample Input 3

1000 2000

Sample Output 3

1500

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using static System.Math;

class P
{
    static void Main()
    {
        int[] xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(xy[0] + xy[1] - gcd(xy[0], xy[1]) + 1);
    }

    static int gcd(int a, int b)
    {
        if (a < b) return gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}