ARD1 - The Easiest Sequence Of the World!!

 

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

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

hide comments
2013-02-17 11:51:31 chicku
Reaaly the easiest sequence ever.Just try observe the pattern nd u will get it
2012-12-12 18:20:10 Anuj_LuckFove!
this is far from being the easiest sequence !! :/ just got it after spending hours on this one...
2012-11-19 06:23:05 Paul Draper
Mmmm...easiest sequence of the world, really? You can't think of anything that's easier? Huh.
2012-10-12 04:57:50 Aayush Bahuguna
Nice problem :)
2012-10-12 04:57:50 ABHISHEK SRIVASTAVA
TJANDRA SIR,,HELP ME OUT IN FINDING THE LOGIC OF THIS SERIES,,??
2012-10-12 04:57:50 nani


Last edit: 2012-09-02 04:35:40
2012-10-12 04:57:50 Francky
I agree with numerix, there's absolutely no reason to limit languages. Please open to all.
2012-10-12 04:57:50 numerix
Please open it for all languages!
2012-10-12 04:57:50 imrhk
what is the output of 10^11 ?
2012-10-12 04:57:50 AC Srinivas
something related with matrices?

Last edit: 2012-08-19 03:56:47
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.