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

#BF0000045. Bài toán ma trận (The Matrix Problem)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Bài toán ma trận (The Matrix Problem)

The Matrix Problem

Source: HDU

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive N×MN\times M matrix CC and bounds L≤UL\le U, determine whether positive row multipliers aia_i and positive column divisors bjb_j exist such that L≤Cijai/bj≤UL\le C_{ij}a_i/b_j\le U for every cell.

Input

First line N,M,L,UN,M,L,U, followed by the NN rows of MM integers each.

Output

Print YES or NO.

Subtasks

  • Subtask 1 (20 points): 1≤N,M≤61\le N,M\le6, 1≤L≤U≤100001\le L\le U\le10000; 1≤Cij≤10001\le C_{ij}\le1000.
  • Subtask 2 (30 points): 1≤N,M≤701\le N,M\le70, 1≤L≤U≤100001\le L\le U\le10000; 1≤Cij≤10001\le C_{ij}\le1000.
  • Subtask 3 (50 points): 1≤N,M≤4001\le N,M\le400, 1≤L≤U≤100001\le L\le U\le10000; 1≤Cij≤10001\le C_{ij}\le1000.

Examples

Input

3 3 1 6
2 3 4
8 2 6
5 2 9

Output

YES

Explanation

Choose row multipliers a=(1,0.5,0.5)a=(1,0.5,0.5) and column divisors b=(1,1,1)b=(1,1,1). The transformed matrix has rows (2,3,4)(2,3,4), (4,1,3)(4,1,3), and (2.5,1,4.5)(2.5,1,4.5). All entries lie in [1,6][1,6], so the answer is YES.