#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

Rar the Cat has a row of *N* fish on his dinner table, numbered 0 to *N* - 1 from left to right, and the *i*th fish has a tag with the integer *A _{i}* hung onto it.

Rar can pick any non-empty consecutive segment of fish to eat for lunch, but he decides that the *satisfaction* of the meal would be equivalent to the product of the tag numbers of all the fish he ate.

Help Rar determine the maximum *satisfaction* he can get, modulo 10^{9} + 7.

## Input

The first line of input will contain one integer, *N*.

The next line of input will contain *N* integers, with the *i*th integer being *A _{i}*.

## Output

The output should contain one integer, the maximum satisfaction, modulo 10^{9} + 7.

## Limits

Subtask 1 (8%): 1 ≤ N ≤ 2 000, |A_{i}| ≤ 10^{9}. The answer would fit into a signed 64-bit integer.

Subtask 2 (17%): 1 ≤ N ≤ 2 000, |A_{i}| ≤ 10^{9}.

Subtask 3 (13%): 1 ≤ N ≤ 100 000, 0 ≤ A_{i} ≤ 10^{9}.

Subtask 4 (20%): 1 ≤ N ≤ 100 000, |A_{i}| ≤ 1.

Subtask 5 (19%): 1 ≤ N ≤ 100 000, |A_{i}| ≤ 10^{9}.

Subtask 6 (23%): 1 ≤ N ≤ 1 000 000, |A_{i}| ≤ 10^{9}.

Subtask 7 (0%): Sample Testcases

## Sample Testcase 1

### Input

5 -4 -2 -2 3 6

### Output

72

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 8 | 21 | 1s | 64MB | Minimum |

2 | 17 | 41 | 1s | 64MB | Minimum |

3 | 13 | 20 | 1s | 64MB | Minimum |

4 | 20 | 20 | 1s | 64MB | Minimum |

5 | 19 | 100 | 1s | 64MB | Minimum |

6 | 23 | 120 | 1s | 64MB | Minimum |

7 | 0 | 1 | 1s | 64MB | Minimum |

### Judge Compile Command

g++-7 ans.cpp -o fishmeal -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512