题目描述
Background
Under the bombardment of cosmic rays, some of Lianzi's predefined functions on her computer have been damaged.
For a science student, various software tools are crucial for learning and research. To quickly restore the normal functioning of the software on her computer, she needs to rewrite these functions as soon as possible.
Problem Description
Specifically, given two integers \(a, b\), with the guarantee that \(b \neq 0\). Lianzi needs to implement a function \(\operatorname{fun}(a, b)\) to transfer the sign of \(b\) to \(a\).
Specifically, \(\operatorname{fun}(a, b) = \operatorname{sgn}(b) \times |a|\), where \(\operatorname{sgn}(b) = \begin{cases} 1 & \text{if } b > 0 \\ -1 & \text{if } b < 0 \end{cases}\).
In other words:
- If \(b\) is positive, then \(\operatorname{fun}(a, b) = +|a| = |a|\);
- If \(b\) is negative, then \(\operatorname{fun}(a, b) = -|a|\).
Input Format
- A single line containing two integers \(a, b\).
Output Format
- A single line containing the value of \(\operatorname{fun}(a, b)\).
Sample Input and Output
Sample Input #1
-1 2
Sample Output #1
1
Sample Input #2
0 -4
Sample Output #2
0
Sample Input #3
-12345 -54321
Sample Output #3
-12345
Notes
For all data, \(a, b\) are within the range of 32-bit signed integers, and \(b \neq 0\).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分