Train Passengers

No attempts yetTime limit1sMemory limit256 MB

Problem

A railway company keeps a record of one train on one journey. At every station where the train stops, the station master writes down three numbers: how many passengers left the train, how many boarded it, and how many were still waiting on the platform when the train pulled away.

The record has to obey these rules.

  • The train never carries more than CC passengers and never fewer than 00. At each station the leaving passengers all get off before anybody boards.
  • Nobody waits in vain. If at least one passenger was left waiting at a station, the train is full right after boarding at that station, so it carries exactly CC passengers.
  • The train starts the journey empty and finishes it empty. At the last station every passenger on board leaves, nobody boards, and nobody is left waiting.

The numbers were collected on a snowy day, so a station master may have stayed in a warm office and made them up instead of going out to count. Decide whether the record can describe a real journey.

Input

The first line contains two integers CC and nn (2n1002 \le n \le 100), the capacity of the train and the number of stations where it stops.

Each of the next nn lines contains three integers: the number of passengers who left the train at that station, the number who boarded, and the number who stayed waiting on the platform. The lines follow the order in which the train visits the stations.

Every integer, CC included, is between 00 and 10910^9.

Output

Print one word. Print possible if the record obeys every rule, and impossible otherwise.