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
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!

ashimk: 2018-03-17 11:51:56

Unclear explanation of the problem costed me 3 WA's ..... Deserves Downvote :p)
PS: Comments came into rescue!

le9018468: 2018-03-17 02:51:38

Last edit: 2018-03-17 08:33:16
rob_in_1: 2018-03-05 19:21:51

10 20 30 50 60 70 75 80 90 100
what will be the answer for this case ?
It should be 100 but it is 110.


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