Problem:
Score : 100 points

Problem Statement

There is an N-car train.

You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Constraints

1 \leq N \leq 100

1 \leq i \leq N

Input

Input is given from Standard Input in the following format:

N i

Output

Print the answer.

Sample Input 1

4 2

Sample Output 1

3

The second car from the front of a 4-car train is the third car from the back.

Sample Input 2

1 1

Sample Output 2

1

Sample Input 3

15 11

Sample Output 3

5

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

using System;
using System.Collections.Generic;
using System.Linq;

namespace algorithm
{
	class Program
	{

		static void Main(string[] args)
		{
			//全体/必要本数
			var q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			//座標
			var b = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			q[1]--;
			//末端の近さ
			
			//0から近い端を調べる
			int str = 0,end = 0 ;
			int cost = int.MaxValue;
			int tmp = 0;
			for (int i =0;i<q[0]-q[1]; i++)
			{
				str = Math.Min(b[i], b[q[1]+i]);
				end = Math.Max(b[i], b[q[1]+i]);
				tmp = Math.Abs(str) + Math.Abs(end) + Math.Min(Math.Abs(str), Math.Abs(end));
				cost = Math.Min(tmp, cost);

			}
			
			//出力
			Console.WriteLine(cost);
			Console.ReadLine();
		}
	}
}