An Excursion In Mathematics
Practice
3 (1 votes)
Modular arithmetic
Medium Hard
Math
Problem
40% Success 125 Attempts 50 Points 1s Time Limit 256MB Memory 1024 KB Max Code

As Brutus betrayed Caesar he is planning to attack Brutus. But he knows Brutus cannot be defeated easily so he plans to use the excalibur sword. But there is one problem. To activate the sword he needs to solve the problem written on the sword. Can you help Caesar activate the sword by solving this problem??

Given the values of A(\(X^2+Y^2+Z^2\)), B(\(X^4+Y^4+Z^4\)), C(\(X^5+Y^5+Z^5\)). Calculate the value of sum of values of \(X^i+Y^i+Z^i\) where i goes from L to R modulo 1e9+7.

\(Input :\)

First line of the Input contains an integer T denoting the number of testcases. Each testcase contains two lines. The first line contains 3 integers A, B and C. The next line contains 2 integers L and R

\(Output :\)

print a single integer denoting the summation.

\(Constraints\) :

\(1 \le X,Y,Z \le 3000\)

\(1 \le T \le 10^3\)

\(1 \le L \le R \le 10^{18}\)

Problem setter : Sheldon Tauro

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
No similar problems found