Mobile coding works. A laptop is faster for long sessions.

Problem

The program reads from standard input five integers a, b, c, L, R, separated by spaces. Consider the expression:

f(x) = a x x + b * x + c

Compute the minimum value that f takes when x ranges over every integer in the interval [L, R], and print:

  • first, the value x at which this minimum is achieved (if there are several, print the smallest);
  • then, separated by a space, the minimum value f(x).

Input format

Input input.txt

The program reads from standard input on a single line the five numbers: `a b c L R`. - `-1000 <= a, b, c <= 1000` - `-1000 <= L <= R <= 1000` - All intermediate values fit in `long long`.

Output format

Output output.txt

The program prints to standard output on a single line two integers: `x` and `f(x)`, separated by a space.

Example

input
1 -4 5 0 10
output
2 1

Ready to solve this challenge?

Create a free account to write code, submit solutions, and track your progress.

⌨️ Keyboard Shortcuts

Code Editor
Run Code
Ctrl Enter
Submit Code
Ctrl Shift Enter
Format Code
Shift Alt F
Toggle Comment
Ctrl /
Undo
Ctrl Z
Redo
Ctrl Y
Navigation
Global Search
/
Show Shortcuts
?
Close Modal
Esc

🔍 Interactive Debugger

0 / 0

Analyzing your code...

📦 Variables

No variables yet

📚 Call Stack
main() line 1
📤 Output