Living Cost

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Beo go to market every sunday to buy ~3~ kinds of food which he need for the next week. The kinds of food have price ~p_1, p_2,~ and ~p_3~ for each piece respectively. With the exactly ~X~ vnd, how many ways he can buy?

Input

  • The first line has an integer ~X~ ~(1 ≤ X ≤ 10^7)~.
  • The second line has ~3~ integers ~p_1, p_2, p_3~ respectively ~(1 ≤ p_i ≤ 10_7)~.

Output

  • Print the number of way he can buy.

Sample Input

28
3 5 7

Sample Output

6

Notes

Beo can buy any of these set

  • ~(0\times3+0\times5+4\times7)~,
  • ~(1\times3+5\times5+0\times7)~,
  • ~(2\times3+3\times5+1\times7)~,
  • ~(3\times3+1\times5+2\times7)~,
  • ~(6\times3+2\times5+0\times7)~,
  • ~(7\times3+0\times5+1\times7)~.

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.