XY is playing a game:there are N pillar in a row,which numbered from 1 to n.Each pillar has a jewel.Now XY is standing on the S-th pillar and the exit is in the T-th pillar.XY can leave from the exit only after they get all the jewels.Each time XY can move to adjacent pillar,or he can jump to boundary ( the first pillar or the N-th pillar) by using his superpower.However,he needs to follow a rule:if he left the pillar,he no can not get here anymore.In order to save his power,XY wants to use the minimum number of superpower to pass the game.

There are multiple test cases, no more than 1000 cases.

For each case,the line contains three integers:N,S and T.$(1\leq N\leq10000,1\leq S,T\leq N )$

For each case,the line contains three integers:N,S and T.$(1\leq N\leq10000,1\leq S,T\leq N )$

提交代码