游客 Signup | Login
中文 | En

3935 - 喵同学的小鱼干

喵同学特别喜欢吃小鱼干,一看到小鱼干就会吃个不停。由于她想吃到更多的小鱼干,于是她决定去碰碰手气。已知喵同学赢一局可以赢得a只小鱼干,输一局会输掉b只小鱼干,喵同学现在有100只小鱼干作为本金,则她赢了x局输了y局后还有多少只小鱼干?

Input

给出四个整数a, b, x, y以空格隔开;

1<= a, b <=101<= x, y <=100

Output

输出喵同学最后可以吃到的小鱼干数

Examples

Input

1 1 1 1

Output

100

Solution C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;

int main()
{
  //freopen("in.txt", "r", stdin);
  //freopen("out.txt", "w", stdout);
  int a, b, x, y;
  while(scanf("%d%d%d%d", &a, &b, &x, &y) != EOF)
  {
    int ans = 100 + a * x - b * y;
    if(ans <= 0)
      printf("0\n");
    else
      printf("%d\n", ans);
  }
  return 0;
}

Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题