130E.md (650B)
1 Source: https://codeforces.com/problemset/problem/130/E 2 3 E. Tribonacci numbers 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Tribonacci numbers are a sequence of numbers, defined as follows: 22 23 * *t*0 = *t*1 = 0, 24 * *t*2 = 1, 25 * *t**i* = *t**i* - 1 + *t**i* - 2 + *t**i* - 3. 26 27 You are given *n*; calculate *n*-th tribonacci number modulo 26. 28 29 Input 30 31 The only line of input contains an integer *n* (1 ≤ *n* ≤ 1000). 32 33 Output 34 35 Output *n*-th tribonacci number modulo 26. 36 37 Examples 38 39 Input 40 41 ``` 42 4 43 ``` 44 45 Output 46 47 ``` 48 2 49 ``` 50 51 Input 52 53 ``` 54 9 55 ``` 56 57 Output 58 59 ``` 60 18 61 ```