AlgoUniversity
  • Go Back
Discussion
Find The Array :

Author

Ujjwal Srivastava

Difficulty Level : Easy

Submissions : 98

Asked In : Bhanzu

Marks :10

: 0 | : 0

Given an integer array, $$$A$$$ of length $$$N$$$ and the sum of the elements of this array is $$$X$$$. You are also given an integer array $$$B$$$ of length $$$N$$$ which is given as $$$B_{i} = X - A_{i}$$$ for all $$$ 0 \le i \le N-1$$$. Your task is to find Array $$$A$$$.

Input

The first line contains an integer $$$N$$$. The next line contains an array $$$B$$$ having $$$N$$$ elements where $$$B_{i} = X - A_{i}$$$ for all $$$ 0 \le i \le N-1$$$.$$$(2 \le N \le 10^5)$$$$$$(0 \le B_{i} \le 10^5).$$$

Output

Output the integer array $$$A$$$.

Examples

Input
3
1 3 4
Output
3 1 0 
Input
5
25539 29221 6895 82089 0
Output
10397 6715 29041 -46153 35936 

Note

For a given array $$$B_{i}$$$, there will always be an array $$$A_{i}.$$$

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.