Manhattan
시간 제한1초메모리 제한1024 MB
서로 겹치지 않는 두 축 정렬 직사각형이 주어질 때, 한 직사각형의 격자점에서 다른 직사각형의 격자점으로 가는 맨해튼 경로의 수를 666013으로 나눈 나머지를 구한다.
문제
In the first quadrant of the cartesian plan, we define a zone, denoted by , as a set of lattice points which belong to a rectangle defined by to diagonally opposite points, and , with and . In particular, a zone can contain points on a single segment when or . Also, it may be formed from a single point, if and .
A path between two lattice points is defined as a minimal set of horizontal and vertical segments of length which join the two points.
Given two zones and which do not intersect in any point, compute the number of distinct paths, modulo , that start in and end in .
입력
The first line contains integers , the boundaries of the two zones.
출력
The output should containt a single number representing the number of distinct paths modulo .