#CCBOTPBA0000009. Sum of Consecutive Odd Numbers III
Sum of Consecutive Odd Numbers III
Sum of Consecutive Odd Numbers III
Source: beecrowd
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers X and Y, sum exactly Y consecutive odd integers starting from the smallest odd integer not smaller than X.
Input
One line contains X Y; there is no leading case count.
Output
Print the required integer sum.
Subtasks
-
Subtask 1 (20%):
-20 ≤ X ≤ 20,Y ≤ 10. -
Subtask 2 (30%):
-1000 ≤ X ≤ 1000,Y ≤ 100. -
Subtask 3 (50%):
-100000 ≤ X ≤ 100000,Y ≤ 100000.
Examples
Example 1
Input:
4 3
Output:
21
Explanation: The sequence is 5, 7, 9, summing to 21.
Example 2
Input:
-3 3
Output:
-3
Explanation: The sequence is -3, -1, 1, summing to -3.