### 题目描述

There are famous Russian nesting dolls named matryoshkas sold in one of the souvenir stores nearby, and you’d like to buy several of them. The store has n different matryoshkas. Any matryoshka is a figure of volume outi with an empty space inside of volume ini (of course, outi>ini).

You don’t have much free space inside your bag, but, fortunately, you know that matryoshkas can be nested one inside another. Formally, let’s call a set of matryoshkas nested if we can rearrange dolls in such a way, that the first doll can be nested inside the second one, the second doll — inside the third one and so on. Matryoshka i can be nested inside matryoshka j if outi≤inj. So only the last doll will take space inside your bag.

Let’s call extra space of a nested set of dolls as a total volume of empty space inside this structure. Obviously, it’s equal to $in_{i_1}+(in_{i_2}−out_{i_1})+(in_{i_3}−out_{i_2})+⋯+(in_{i_k}−out_{i_{k−1}})$, where $i_1, i_2, ..., i_k$ are the indices of the chosen dolls in the order they are nested in each other.

Finally, let’s call a nested subset of the given sequence as big enough if there isn’t any doll from the sequence that can be added to the nested subset without breaking its nested property.

You want to buy many matryoshkas, so you should choose a big enough nested subset to buy it. But you will be disappointed if too much space in your bag will be wasted, so you want to choose a big enough subset so that its extra space is minimum possible among all big enough subsets. Now you wonder, how many different nested subsets meet these conditions (they are big enough, and there is no big enough subset such that its extra space is less than the extra space of the chosen subset). Two subsets are considered different if there exists at least one index i such that one of the subsets contains the i-th doll, and another subset doesn’t.

Since the answer can be large, print it modulo 10^{9}+7.