Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 5 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 9.00

fibonacci sequence

Recently Bheem and their friends studied well known fibonacci sequence in their school. Afibonacci sequence is generated by the recursive formula: F[n]=F[n-1]+F[n-2]
where n>1 and F[0]=F[1]=1. Then Bheem started playing with similar type of sequences. In this process he came up with generalized tetranacci numbers.
Generalized tetranacci numbers are defined by following recurrence relation:
T[n] = a*T[n-1] + b*T[n-2] + c*T[n-3] + d*T[n-4] +e (n>4)
where T[1], T[2], T[3] and T[4]can be any given integer.

Bheem tried to calculate the value of this sequence upto a given number n, but he was unable to calculate the value of nth term instantly.
Given the values of n, a, b, c, d, e, T[1], T[2], T[3] and T[4]. Help Bheem calculate the value of T[n]. As the answer can be very large, output the answer modulo 1000000007.
Note: The answer should always be a positive integer.

 

Input

  • The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows
  • The first line of each test case contains a single integer n.
  • The second line of each test cases contains 9 separated integers a, b, c, d, e, T[1], T[2], T[3] and T[4].

 

Output

  • For each test case, output a single line containing the answer to given problem modulo 1000000007

 

Constraints

  • 1 = T = 1000

Answers

(5)
Status NEW Posted 17 Sep 2017 12:09 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)