The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
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.
Â
Â
Â
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