Problem:
Score: 100 points

Problem Statement

There is a train going from Station A to Station B that costs X yen (the currency of Japan).

Also, there is a bus going from Station B to Station C that costs Y yen.

Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.

How much does it cost to travel from Station A to Station C if she uses this ticket?

Constraints

1 \leq X,Y \leq 100

Y is an even number.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

If it costs x yen to travel from Station A to Station C, print x.

Sample Input 1

81 58

Sample Output 1

110

The train fare is 81 yen.

The train fare is 58 ⁄ 2=29 yen with the 50% discount.

Thus, it costs 110 yen to travel from Station A to Station C.

Sample Input 2

4 54

Sample Output 2

31

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

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

// ABC 113
// https://atcoder.jp/contests/dp/tasks
namespace ABC113D_Amidakuji
{
	public class Solver : SolverBase
	{
		// [縦棒本数] = 横棒の入れ方パターン数
		static readonly long[] Total = {0, 1, 2, 3, 5, 8, 13, 21, 34};
		// W3:縦棒3本の場合の、縦棒間の「横棒ありパターン数」
		//    W3[1]は 縦棒1-2 間の「横棒ありパターン数」
		//    ※縦棒番号は左から1, 2, ... とする
		static readonly long[] W1 = { 0, 0 };
		static readonly long[] W2 = { 0, 1, 0 };
		static readonly long[] W3 = { 0, 1, 1, 0 };
		static readonly long[] W4 = { 0, 2, 1, 2, 0 };
		static readonly long[] W5 = { 0, 3, 2, 2, 3, 0 };
		static readonly long[] W6 = { 0, 5, 3, 4, 3, 5, 0 };
		static readonly long[] W7 = { 0, 8, 5, 6, 6, 5, 8, 0 };
		static readonly long[] W8 = { 0, 13, 8, 10, 9, 10, 8, 13, 0 };

		static readonly List<long[]> WAry = new List<long[]>{ W1, W2, W3, W4, W5, W6, W7, W8 };

		const int MOD = 1000000007;
		public void Run() {
			var ary = ReadIntArray();
			var H = ary[0];
			var W = ary[1];
			var K = ary[2];

			if (W == 1) {
				WriteLine(1);
				return;
			}

			var WP = WAry[W - 1];

			// DP[pos行目][左からw列目] = 当該節点に存在するパターン数
			//   スタート地点（pos=0, w=1）だけが 1 で、それ以外は全部0
			//   例えば、pos1, w1-2 間に横棒があったばあい、
			//   pos=1, w=1 にはとどまれず、pos=1, w=2 にとどまることになる。
			//   ※パターン数は mod MOD したもの
			long[,] DP = new long[H+1, W+2];
			DP[0, 1] = 1;

			// 配るDP
			for (int pos = 0; pos < H; pos++) {
				for (int w = 1; w <= W; w++) {
					if (DP[pos, w] == 0) continue;

					// w-1, w, w+1 に進む各パターン数を求める
					var lp = WP[w - 1];
					var rp = WP[w];
					var cp = Total[W] - lp - rp;

					// 配布
					if (0 < lp) {
						// 左に進む
						DP[pos + 1, w - 1] = (DP[pos + 1, w - 1] + DP[pos, w] * lp) % MOD ;
					}
					if (0 < rp) {
						// 右に進む
						DP[pos + 1, w + 1] = (DP[pos + 1, w + 1] + DP[pos, w] * rp) % MOD;
					}
					// そのまま下に進む
					DP[pos + 1, w] = (DP[pos + 1, w] + DP[pos, w] * cp) % MOD;
				}
			}
			DumpDP(DP);

			// Kに到着するパターン数
			var ans = DP[H, K];
			WriteLine(ans);
		}

#if !MYHOME
		public static void Main(string[] args) {
			new Solver().Run();
		}
#endif
	}


	public static class Util
	{
		public static string DumpToString<T>(IEnumerable<T> array) where T : IFormattable {
			var sb = new StringBuilder();
			foreach (var item in array) {
				sb.Append(item);
				sb.Append(", ");
			}
			return sb.ToString();
		}

		public static void InitArray<T>(T[] ary, T value) {
			for (int i = 0; i < ary.Length; i++) {
				ary[i] = value;
			}
		}

		public static void InitDP<T>(T[,] dp, T value) {
			for (int i = 0; i < dp.GetLength(0); i++) {
				for (int j = 0; j < dp.GetLength(1); j++) {
					dp[i, j] = value;
				}
			}
		}

		public static T Max<T>(params T[] nums) where T : IComparable {
			if (nums.Length == 0) return default(T);

			T max = nums[0];
			for (int i = 1; i < nums.Length; i++) {
				max = max.CompareTo(nums[i]) > 0 ? max : nums[i];
			}
			return max;
		}
	}

	public class SolverBase
	{
		virtual protected string ReadLine() => Console.ReadLine();
		virtual protected int ReadInt() => int.Parse(ReadLine());
		virtual protected long ReadLong() => long.Parse(ReadLine());
		virtual protected string[] ReadStringArray() => ReadLine().Split(' ');
		virtual protected int[] ReadIntArray() => ReadLine().Split(' ').Select<string, int>(s => int.Parse(s)).ToArray();
		virtual protected long[] ReadLongArray() => ReadLine().Split(' ').Select<string, long>(s => long.Parse(s)).ToArray();
		virtual protected double[] ReadDoubleArray() => ReadLine().Split(' ').Select<string, double>(s => double.Parse(s)).ToArray();
		virtual protected void WriteLine(string line) => Console.WriteLine(line);
		virtual protected void WriteLine(double d) => Console.WriteLine($"{d:F9}");
		virtual protected void WriteLine<T>(T value) where T : IFormattable => Console.WriteLine(value);

		[Conditional("DEBUG")]
		protected void Dump(string s) => Console.WriteLine(s);
		[Conditional("DEBUG")]
		protected void Dump(char c) => Console.WriteLine(c);
		[Conditional("DEBUG")]
		protected void Dump(double d) => Console.WriteLine($"{d:F9}");
		[Conditional("DEBUG")]
		protected void Dump<T>(IEnumerable<T> array) where T : IFormattable {
			string s = Util.DumpToString(array);
			// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
			Console.WriteLine(s);
			//_writer.WriteLine(s);
		}
		[Conditional("DEBUG")]
		protected void DumpGrid<T>(IEnumerable<IEnumerable<T>> arrayOfArray) where T : IFormattable {
			var sb = new StringBuilder();
			foreach (var a in arrayOfArray) {
				sb.AppendLine(Util.DumpToString(a));
			}
			// Consoleに出力すると、UnitTestの邪魔をしないというメリットあり。
			Console.WriteLine(sb.ToString());
			//_writer.WriteLine(sb.ToString());
		}
		[Conditional("DEBUG")]
		protected void DumpDP<T>(T[,] dp) where T : IFormattable {
			var sb = new StringBuilder();
			for (int i = 0; i < dp.GetLength(0); i++) {
				for (int j = 0; j < dp.GetLength(1); j++) {
					sb.Append(dp[i, j]);
					sb.Append(", ");
				}
				sb.AppendLine();
			}
			Console.WriteLine(sb.ToString());
		}
	}
}