Thanks_up的爱情线

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

图片.png


Thanks_up有一条长为n的爱情线,但是ACM不需要爱情,所以他决定把它剪掉,但是Thanks_up有强迫症,

Thanks_up设置了两个规定,1、必须将爱情线剪成长度a,b,c长度的,2、剪完后线必须最多


Thanks_up剪完爱情线后,痛哭流涕不想算,所以他请你们算一下,剪完后爱情线的数量是多少

Thanks_up说了如果你们不能在1s内回答出来,他也把你们的爱情线剪掉


Input

The first line contains four space-separated integers n, a, b and c (1 ≤ n, a, b, c ≤ 4000) — the length of the original ribbon and the acceptable lengths of the ribbon pieces after the cutting, correspondingly. The numbers a, b and c can coincide.


第一行包含四个空格分隔的整数n,a,b和c(1≤n,a,b,c≤4000) - 相应地,Thanks_up爱情线的长度和剪后爱情线碎片的可接受长度。 数字a,b和c可以重合。

Output

Print a single number — the maximum possible number of ribbon pieces. It is guaranteed that at least one correct ribbon cutting exists.



打印一个数字 - 爱情线可能的最大条数。 保证至少存在一个正确的爱情线切割。

SampleInput 1
5 5 3 2
SampleOutput 1
2
SampleInput 2
7 5 5 2
SampleOutput 2
2
Note

In the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.

In the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2.

Submit
题目统计信息详细
总AC数16
通过人数13
尝试人数16
总提交量30
AC率43.33%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: