PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#TP0000078. Các chỉ dẫn của robot (Robot Instructions)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Các chỉ dẫn của robot (Robot Instructions)

Robot Instructions

Source: USACO

Version: Phuoc Hung OJ Extended

Problem Statement

A robot starts at (0,0)(0,0). Each of NN distinguishable instructions adds vector (xi,yi)(x_i,y_i). For every K=1,…,NK=1,\ldots,N, count size-KK subsets of instructions whose sum equals the destination (xg,yg)(x_g,y_g).

Input

Line 1: NN. Line 2: destination xg,ygx_g,y_g. Next NN lines: displacement vectors xi,yix_i,y_i.

Output

Print exactly NN lines, one answer for each subset size K=1,…,NK=1,\ldots,N.

Subtasks

  • Subtask 1 (20 points): Exactly one dataset; 1≤N≤91\le N\le9; −109≤xg,yg,xi,yi≤109-10^9\le x_g,y_g,x_i,y_i\le10^9; the goal and every instruction vector are nonzero; instruction indices distinguish choices.
  • Subtask 2 (30 points): Exactly one dataset; 1≤N≤181\le N\le18; −109≤xg,yg,xi,yi≤109-10^9\le x_g,y_g,x_i,y_i\le10^9; the goal and every instruction vector are nonzero; instruction indices distinguish choices.
  • Subtask 3 (50 points): Exactly one dataset; 1≤N≤401\le N\le40; −109≤xg,yg,xi,yi≤109-10^9\le x_g,y_g,x_i,y_i\le10^9; the goal and every instruction vector are nonzero; instruction indices distinguish choices.

Example

Input

3
1 1
1 0
0 1
1 1

Output

1
1
0

Explanation

There is one size-one subset selecting (1,1) and one size-two subset selecting (1,0),(0,1); no size-three subset works.