编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?