#abc259a. A - Growth Record

A - Growth Record

Score : 100100 points

问题描述

Takahashi 在他第 NN 个生日时,身高为 TT 厘米。
另外,我们还知道以下事实:

  • 在从 Takahashi 出生(0岁生日)到第 XX 个生日的每一年中,他的身高增长了 DD 厘米。更正式地讲,对于每个 i=1,2,,Xi = 1, 2, \ldots, X,他在从第 (i1)(i-1) 个生日到第 ii 个生日之间身高增加了 DD 厘米。
  • 在 Takahashi 的第 XX 个生日和第 NN 个生日之间,他的身高没有发生变化。

求 Takahashi 在他第 MM 个生日时的身高,以厘米为单位。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi had his NN-th birthday, when he was TT centimeters tall.
Additionally, we know the following facts:

  • In each year between Takahashi's birth (00-th birthday) and his XX-th birthday, his height increased by DD centimeters. More formally, for each i=1,2,,Xi = 1, 2, \ldots, X, his height increased by DD centimeters between his (i1)(i-1)-th birthday and his ii-th birthday.
  • Between Takahashi's XX-th birthday and his NN-th birthday, his height did not change.

Find Takahashi's height on his MM-th birthday, in centimeters.

Constraints

  • 0M<N1000 \leq M \lt N \leq 100
  • 1XN1 \leq X \leq N
  • 1T2001 \leq T \leq 200
  • 1D1001 \leq D \leq 100
  • Takahashi was at least 11 centimeter tall at his birth.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM XX TT DD

Output

Print the answer as an integer.

Sample Input 1

38 20 17 168 3

Sample Output 1

168

In this sample, Takahashi was 168168 centimeters tall on his 3838-th birthday. Also, his height did not change between his 1717-th birthday and 3838-th birthday.
From these facts, we find that he was 168168 centimeters tall on his 2020-th birthday, so the answer is 168168.

Sample Input 2

1 0 1 3 2

Sample Output 2

1

In this sample, Takahashi was 11 centimeter tall on his 0(=M)0(=M)-th birthday and 3(=T)3(=T) centimeters tall on his 1(=N)1(=N)-st birthday.

Sample Input 3

100 10 100 180 1

Sample Output 3

90

update @ 2024/3/10 10:58:59