CF208D Prizes, Prizes, more Prizes

题目描述

## 题意 你有 $n$ 块巧克力可以吃,每块巧克力包装背后有一个积分,要用这些积分去换 $5$ 种不同价格的礼物。你每次只能吃一块,吃完后去换礼物,要求先换价格尽量高的礼物,然后要把积分尽量用完,用不完的积分可以留在下一次和下一个积分合并再用。请输出能换到每种礼物的数量和剩余的积分。

输入格式

第一行包含一个整数 $n$($1\le n\le50$)— 表示巧克力的数量。 第二行包含 $n$ 个空格分隔的整数 $p_1,p_2, \dots,p_n$($1\le p_i\le10^9$),分别表示每个巧克力的积分。 第三行包含 $5$ 个整数 $a,b,c,d,e$($1\le a

输出格式

第一行输出 $5$ 个整数,依次表示能换到每种礼物的数量。 在输出一个整数,表示完成所有兑换操作后 Vasya 剩余的积分。 翻译:Xuorange

说明/提示

In the first sample Vasya gets $ 3 $ points after eating the first chocolate bar. Then he exchanges $ 2 $ points and gets a mug. Vasya wins a bag after eating the second chocolate bar. Then he wins a towel after eating the third chocolate bar. After all chocolate bars $ 3-2+10-10+4-4=1 $ points remains.