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

#QHD0000025. Chiến lược học thi (Term Strategy)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Chiến lược học thi (Term Strategy)

Term Strategy

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A student is preparing for exams in NN subjects and has at most MM hours to study.

For subject ii, spending exactly jj hours gives grade Li,jL_{i,j} on a scale of 00 through 1010. Each subject must receive at least one hour and a passing grade of at least 55. The total hours allocated must not exceed MM.

If passing all subjects is possible, determine the highest possible average grade; otherwise print the specified failure message.

Input

The first line contains NN and MM.

Each of the following NN lines contains MM integers Li,1,…,Li,ML_{i,1},\ldots,L_{i,M}: the grade for subject ii when studying exactly jj hours.

Output

If passing all subjects is impossible, print Peter, you shouldn't have played billiard that much..

Otherwise print Maximal possible average mark - X. where X is the highest average formatted to exactly two decimal places.

Subtasks

  • Subtask 1 (20 points): 1≤N≤31\le N\le 3; 1≤M≤1001\le M\le 100; 0≤Li,j≤100\le L_{i,j}\le 10; Li,jL_{i,j} are nondecreasing with jj; each subject is allotted at least one hour.
  • Subtask 2 (30 points): 1≤N≤71\le N\le 7; 1≤M≤1001\le M\le 100; 0≤Li,j≤100\le L_{i,j}\le 10; Li,jL_{i,j} are nondecreasing with jj; each subject is allotted at least one hour.
  • Subtask 3 (50 points): 1≤N≤101\le N\le 10; 1≤M≤1001\le M\le 100; 0≤Li,j≤100\le L_{i,j}\le 10; Li,jL_{i,j} are nondecreasing with jj; each subject is allotted at least one hour.

Examples

Input

4 5
5 5 6 7 8
5 5 6 7 8
5 6 7 8 8
6 7 8 9 9

Output

Maximal possible average mark - 5.50.

Explanation

Each of the four subjects requires at least one hour, leaving only one extra hour. Allocating (1,1,1,2)(1,1,1,2) hours earns grades (5,5,5,7)(5,5,5,7) for a total of 2222 and an average of 22/4=5.5022/4=5.50. No feasible allocation scores higher, so the stated message is printed.