aboutsummaryrefslogtreecommitdiff
path: root/works/life/chuanzhi-cup/contest/1.cpp
blob: 4a20d97ab31f5ac5ca8e6c850f86451602afaf56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>

int main() {
  int n, v, m, a;
  std::scanf("%d%d%d%d", &n, &v, &m, &a);

  int money = 0;

  v -= a;

  for (int i = 0; i < n; i++) {
    if (i % m == 0) {
      v += a;
    }

    money += v;
  }

  std::printf("%d", money);

  return 0;
}