Peter is a secret spy working against the Soviet Union. In order to fund his work, he creates a simple algorithm that will predict, with 100% accuracy, the future price of any stock in the world. To maximize the profits, he needs to figure out which stock to invest in. Can you help him?

The first line of input contains an integer \(N\). \((2 \le N \le 10^6)\)

The next N lines of input contains a single integer \(C_i\), the price of the stock at day \(i\). \((0 \le C_i \le 10^7)\)

Output, in one line, an integer representing the maximum amount of profit that could be made from trading the stock in question.

If no profit can be made, output `scam`

.

`6`

1

6

3

9

4

5

`8`

Peter can buy this stock when it is valued at \(1\), and sell this stock when it is valued at \(9\), generating a profit of \((9-1)\)

`3`

10

1

1

`scam`

- Points: 7
- Time limit: 2.0s
- Memory limit: 64.0M
- Author: enigma
- Category: Classics
- Type: Implementation
- All Submissions Best Submissions

Comments

- There are no comments.