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
2012-10-12 04:57:50 Zhiang
nice one..
2012-10-12 04:57:50 Mostafa 36a2
so we are three boys here have the same Thinking_Way (is it an english word :) )
any way ... it's not the "Easiest in the word" ...:))
2012-10-12 04:57:50 NeW AcP
where is the problem setter he needs to clarify our doubts.There can be many solutions kindly inc the terms in the seq. or remove this problem

Last edit: 2012-07-24 08:50:41
2012-10-12 04:57:50 NeW AcP
yes,I totally agree with mostfa 3682 ,there can be more then 1 soution I am also getting the same answer as KEN but this does not lead to the answer given by RAJDEEP. atleast inc the sequence given as to avoid many type of solutions.
Problem setter should increase the sequence given in sample.

Last edit: 2012-07-23 11:44:14
2012-10-12 04:57:50 Mostafa 36a2
don.t you think there is more than solution!!??
any thing except what you think will get wa!!
2012-10-12 04:57:50 KEN
is my output correct???
15th term--100
16th term--113
17th term--118
2012-10-12 04:57:50 Vaishali Behl
What is so funny about this sequence?
2012-10-12 04:57:50 Himanshu Srivastava
finally...enjoyed solving :D
2012-10-12 04:57:50 Aradhya
@still alive :: thanks :):)
2012-10-12 04:57:50 Rajesh Kumar
sorry bro :) u cant tell the logic :)

RE: - Okay... :) BTW nice question :) :)

Last edit: 2012-06-29 11:22:18
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.