ARD1 - The Easiest Sequence Of the World!!

no tags 

 

I just found the easiest and funny sequence ever !
Your task is simple. Just write a program to find the Nth term of this sequence!!
The sequence is as follows::
3, 8, 12, 17, 22, 28, 35....

 

I just found the easiest and funny sequence ever !

Your task is simple. Just write a program to find the Nth term of this sequence!!

The sequence is as follows::

3, 8, 12, 17, 22, 28, 35....

 

 

Input

 

First line contains t = number of test cases

and then next t lines follow n. 

1<=n<=10^11

Note-- Value of n is modified to encourage better solutions!

Output

 

Just the output the nth term modulo 123456789

 

Example

Input:
3
1
2
3

Output:
3
8
12

hide comments
chicku: 2013-02-17 11:51:31

Reaaly the easiest sequence ever.Just try observe the pattern nd u will get it

Anuj_LuckFove!: 2012-12-12 18:20:10

this is far from being the easiest sequence !! :/ just got it after spending hours on this one...

Paul Draper: 2012-11-19 06:23:05

Mmmm...easiest sequence of the world, really? You can't think of anything that's easier? Huh.

Aayush Bahuguna: 2012-10-12 04:57:50

Nice problem :)

ABHISHEK SRIVASTAVA: 2012-10-12 04:57:50

TJANDRA SIR,,HELP ME OUT IN FINDING THE LOGIC OF THIS SERIES,,??

nani: 2012-10-12 04:57:50

Last edit: 2012-09-02 04:35:40
Francky: 2012-10-12 04:57:50

I agree with numerix, there's absolutely no reason to limit languages. Please open to all.

numerix: 2012-10-12 04:57:50

Please open it for all languages!

imrhk: 2012-10-12 04:57:50

what is the output of 10^11 ?

AC Srinivas: 2012-10-12 04:57:50

something related with matrices?

Last edit: 2012-08-19 03:56:47

Added by:Aradhya
Date:2012-06-28
Time limit:0.100s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ASM32-GCC MAWK BC C-CLANG C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Resource:Own Problem