GLJIVE - GLJIVE


In front of Super Mario there are 10 mushrooms, arranged in a row. A certain amount of points is awarded for picking each of the mushrooms. Super Mario must pick mushrooms in order they appear, but is not required to pick them all – his goal is to score a number of points as close as possible to 100.

In case there exist two such numbers which are equally close to 100 (e.g. 98 and 102), Mario will pick the greater one (in this case 102).

Help Super Mario and tell him how many points he will score.

Input

Input consists of 10 lines, each of which contains one positive integer less than or equal to 100, denoting the scores awarded for picking each mushroom, in the order that Mario can pick them in.

Output

The first and only line of output must contain the required number of points.

Example

Input:
10
20
30
40
50
60
70
80
90
100

Output:
100

hide comments
Anand: 2015-11-19 15:03:51

I read the comments, i googled "coci gljive". And in the first link there is the PDF.
The 2nd test case of the problem is:

input
1
2
3
5
8
13
21
34
55
89

output
87


1+2+3+5+8+13+21+34 = 87
which is 13 far from 100

BUT
21+34+55 = 110
is only 10 far from 100.
Shouldn't the answer be 110 ??

abhigupta4: 2015-11-04 08:12:00

Wasted around 8 submissions in this because of test case 10.
Exit program if you get sum >= 100 or if 10 values are received and make sure you print sum even if it is less than 100

darkhire21: 2015-11-02 14:54:07

wasted 1 hour ...!!!
fucking question totally worthless.

Rahul Gupta: 2015-10-20 18:18:56

What is #ad-hoc-1?

Kriti Singhal: 2015-08-26 20:16:19

AC in one go.. :)

dev: 2015-08-12 02:01:14

Total misguiding prob statement! comments helped a lot :)

TUSHAR SINGHAL: 2015-08-09 16:24:57

so here comes my 100th joy.....lots of more to do.....

Lai Manh Tuan: 2015-08-04 20:20:51

Please update the problem statement ...
Also this problem is only good for someone has just learnt how to code.

Last edit: 2015-08-04 20:21:29
Akash Goel: 2015-08-04 14:21:12

The problem statement is fine. Its a very easy problem. Just pick every element from the beginning until you find an optimal sum acc. to the given condition.

abhijeet: 2015-07-28 12:33:55

The statement is misguiding. Its not a sliding window question. The author just means which first consecutive mushrooms(a1,a2, a3, ...ak and k<=10) to pick.


Added by:akaki
Date:2011-02-13
Time limit:0.205s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:coci