编程介的小学生 2017-09-17 02:29 采纳率: 20.5%
浏览 686
已采纳

Disappearance

On the morning of December 18 in Gensokyo, Izayoi Sakuya went to Remilia Scarlet's bedroom to wake she up. Strangely, there was no one in the bedroom. Sakuya used her special ability of time freezing and searched every nooks. To her surprise, Remilia was disappeared!

It was really a terrible event for the Scarlet Devil Mansion. Actually, not only Remilia, many other girls in Gensokyo were also disappeared! The famous reporter, Shameimaru Aya, got the news soon and started to investigate this event. She found the girls were abducted by a strange small alien creature.

TH_RemiliaWithQB.jpg
The creature thinks every girl has a potential ability that can be quantized as an entropy S. In addition, every girl has three attributes: Love, Courage and Righteousness. We use three variables B W H to indicate them.

To some incomprehensible reasons, the creature wants to gather entropy as low as possible by abduct girls in Gensokyo. Due to the limitation of the creature itself, the girls it abducted must satisfy the following constraints:

max(Bi) - min(Bi) <= LB
max(Wi) - min(Wi) <= LW
max(Hi) - min(Hi) <= LH
Since the event was happened, Shameimaru Aya need your help to calculate the minimal entropy that the creature can gather. By the way, if there is no way to gather a negative quantity of entropy, the creature will have no interest to our girls.

Input

There are multiple test cases. For each test case:

The first line contains an integer N (1 <= N <= 1000) indicates the number of girls in Gensokyo. Then followed by N lines, each line contains four integers Bi Wi Hi Si and each absolute value of those will not exceed 1000. The last line contains 3 integers LB LW LH and each of them is a non-negative integer which will not exceed 2000.

Output

For each test case, output the minimal entropy that the creature can gather. If there is no way to gather a negative quantity of entropy, output "Error 404, mahou shoujo not found!".

Sample Input

3
2 5 3 -4
3 5 0 -2
1 4 2 -7
2 0 4
1
4 0 4 1
1 1 1
Sample Output

-7
Error 404, mahou shoujo not found!

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-09-30 20:14
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?