P12513 [AOJ] RabbitLunch
普及
题目描述

Example

Input

2 3 1 3 1 0

Output

2

输入格式

见题面

输出格式

见题面

样例输入
2 3 1 3 1 0
样例输出
2