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
1 14 98 276 2 5
424
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
Login to unlock the editorial
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