CF69B Bets

Description

In Chelyabinsk lives a much respected businessman Nikita with a strange nickname "Boss". Once Nikita decided to go with his friend Alex to the Summer Biathlon World Cup. Nikita, as a very important person, received a token which allows to place bets on each section no more than on one competitor. To begin with friends learned the rules: in the race there are $ n $ sections of equal length and $ m $ participants. The participants numbered from $ 1 $ to $ m $ . About each participant the following is known: - $ l_{i} $ — the number of the starting section, - $ r_{i} $ — the number of the finishing section ( $ l_{i}

Input Format

The first line contains two integers $ n $ and $ m $ ( $ 1

Output Format

Print a single integer, the maximal profit in roubles that the friends can get. In each of $ n $ sections it is not allowed to place bets on more than one sportsman.

Explanation/Hint

In the first test the optimal bet is: in the 1-2 sections on biathlete 1, in section 3 on biathlete 3, in section 4 on biathlete 4. Total: profit of 5 rubles for 1 section, the profit of 5 rubles for 2 section, profit of 30 rubles for a 3 section, profit of 20 rubles for 4 section. Total profit 60 rubles. In the second test the optimal bet is: on 1 and 5 sections on biathlete 1, in the 2-4 sections on biathlete 2, in the 6-7 sections on athlete 4. There is no winner in the 8 section. Total: profit of 10 rubles for 1 section, the profit of 15 rubles for 2,3,4 section, profit of 10 rubles for a 5 section, profit of 20 rubles for 6, 7 section. Total profit 105 rubles.