#Lutece1867. 魔法师

魔法师

Migrated from Lutece 1867 魔法师

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

魔法师张兑田想要制造分别x,y,zx,y,z个黄球,绿球,蓝球。

  • 制造一个黄球需要两个黄色水晶。
  • 制造一个绿球需要一个黄色水晶和一个蓝色水晶。
  • 制造一个蓝球需要三个蓝色水晶。

现在魔法师已经有了AA个黄色水晶和BB个蓝色水晶,请问还需要收集多少个水晶(包括蓝水晶和黄水晶)。

聪明的你,可以帮她解决这个问题吗?

Input

输入包括一行五个数A,B,x,y,zA,B,x,y,z,具体含义如上文。
0A,B,x,y,z1000\leq A,B,x,y,z\leq 100

Output

输出一个数表示还需要收集多少个水晶。

Samples

输入数据 1

4 3 2 1 1

输出数据 1

2

输入数据 2

3 9 1 1 3

输出数据 2

1

Resources

学姐姐的比武招妻