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
hellb0y_suru: 2020-04-02 05:22:07

Very bad problem statement.
costed me 6 WA's.

priya_19: 2019-11-10 10:29:43

AC in one go

Last edit: 2019-11-10 10:30:11
nikhil_sarda: 2019-09-05 09:01:21

The question is actually having wrong test cases. What question asks differs from what test cases demands.
Additional information to be added in the question is-
The sum should start from the first element and be contiguous.

Jumpy: 2019-04-14 05:37:22

Unclear problem statement.
1) Think with a greedy approach.

subhamiiit: 2019-02-19 17:05:20

problem statement is not clear....
you have to start from first element....

sandeep48: 2018-12-22 11:39:14

a lot puzzled question,
ac in II go

jareehd: 2018-11-06 21:31:46

my first downvote

masterchef2209: 2018-10-17 23:22:11

AC in 1 go :D

ankur314: 2018-07-11 16:04:27

I think the question is not correct.. if we use bitmask we should get correct answer. But some comments clarified that it needs greedy.. i took different cases and saw that bitmask gives more close answer to 100 than greedy but they accept wrong solution..

markomafko972: 2018-04-22 21:17:51

Did bitmasks, now saw that I need to do greedy! Costed me 2 WA!


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