Registered Users Only

Problem Description

Rar the Cat has bought a new Ferrari and wants to race it down a very long track. However, the track has N traffic lights in his way.

Rar can only race on the track when all traffic lights turn green at the same time. Assume he takes negligible time to traverse the entire road in his very fast Ferrari.

The ith traffic light on the road stays red for Ti minutes, and then turns green for one minute, before turning red again in a periodic fashion.

When Rar arrives at the racing track, all the lights (except those with Ti = 0) have just turned from green to red. Help Rar determine how long he would have to wait to race, in minutes. Since this time may be very long, output it modulo 109 + 7.

Input

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

The second line of input will contain N integers, with the ith integer being Ti.

Output

The output should contain one integer, the time, in minutes, Rar would have to wait, modulo 109 + 7.

Limits

Subtask 1 (23%): 1 ≤ N ≤ 100. Rar would not have to wait more than 105 minutes.