import std.conv, std.stdio, std.string; enum long zero = ``.length; enum long one = `u`.length; enum long two = `us`.length; enum long three = `usa`.length; enum long four = `usag`.length; enum long five = `usagi`.length; enum long six = `usagiu`.length; enum long seven = `usagius`.length; enum long eight = `usagiusa`.length; enum long nine = `usagiusag`.length; enum long ten = `usagiusagi`.length; enum long eleven = `usagiusagiu`.length; enum long twelve = `usagiusagius`.length; enum long thirteen = `usagiusagiusa`.length; enum long fourteen = `usagiusagiusag`.length; enum long fifteen = `usagiusagiusagi`.length; T add(T)(T a, T b) { return mixin(`a ` ~ cast(char)(two << four | eleven) ~ ` b`); } T mul(T)(T a, T b) { return mixin(`a ` ~ cast(char)(two << four | ten) ~ ` b`); } T mod(T)(T a, T b) { return mixin(`a ` ~ cast(char)(two << four | five) ~ ` b`); } enum MO = add(ten^^nine, seven); long[] mul(long[] a, long[] b) { return [ mod(add(mul(a[zero], b[zero]), mul(a[one], b[one])), MO), mod(add(add(mul(a[zero], b[one]), mul(a[one], b[zero])), mul(a[one], b[one])), MO) ]; } void main() { readln; for (string line; (line = readln) !is null; ) { const N = line.chomp.to!long; long[] x = [zero, one], y = [one, zero]; for (long n = N; n; n >>= one) { if (n & one) { y = mul(y, x); } x = mul(x, x); } const ans = mod(add(mul(y[zero], two), mul(y[one], one)), MO); writeln(ans); } }