题目描述
Problem Background
SOL君 (an Hearthstone streamer) and SOL菌 (a lecturer at the Perfect Information Classroom) are good friends.
Problem Description
SOL君 loves eating konjac jelly. SOL菌 also enjoys konjac jelly.
One day, while they were playing Hearthstone together, SOL菌 wanted to serve konjac jelly to his guests.
Konjac jelly is usually stored in the refrigerator at temperature \(a\). However, it is too cold when freshly taken out and needs to be heated. SOL菌 plans to use a magical electric stove to heat the konjac jelly. According to observations, it has the following characteristics:
- When the konjac jelly is below temperature \(c\), it heats up by 1 degree per \(p\) units of time.
- When the konjac jelly reaches temperature \(c\), it requires \(q\) units of time to thaw (everyone knows that the temperature remains constant during a phase change... SOL君 believes jelly is a crystalline substance).
- After the konjac jelly is fully thawed, it heats up by 1 degree per \(r\) units of time.
SOL wants to know the temperature of the jelly after heating for \(x\) units of time.
The temperature is rounded down, meaning that if the remaining time at the end is less than \(p\) (or \(q\)) units of time, it is considered that the jelly's temperature does not change during this short period.
Input Format
The input consists of a single line with 6 integers: \(a\), \(c\), \(p\), \(q\), \(r\), and \(x\).
Output Format
The output consists of a single integer: the temperature of the jelly.
Sample Input and Output
Sample Input #1
-10 0 2 1 3 26
Sample Output #1
1
Sample Input #2
-10 0 2 1 3 27
Sample Output #2
2
Notes
For 30% of the test cases, \(|a|, |c| \leq 200\), \(x \leq 100\).
For 60% of the test cases, \(|a|, |c| \leq 2 \times 10^9\), \(x \leq 100\).
For 100% of the test cases, \(|a|, |c| \leq 2 \times 10^9\), \(1 \leq x, p, q, r \leq 10^9\).
There might be cases where \(a = c\), which is considered as the unthawed state.
Hint: Use the long long data type.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分