import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; // 2 2 8 28 152 952 7208 static void solve() { out.println(go(ni())); // for(int i = 3;i <= 9;i++){ // tr(i, go(i)); // } } static long go(int n){ if(n == 1)return 1; int mod = 1000000007; // int n = ni(); long[][][] pre = new long[n+1][2][2]; // [violateしている列の個数][2個上の行がviolateしているかどうか][1個上の行がviolateしているかどうか] long[][][] cur = new long[n+1][2][2]; pre[0][0][0] = 2; for(int i = 2;i < n;i++){ for(int j = 0;j <= n;j++){ for(int k = 0;k < 2;k++){ for(int l = 0;l < 2;l++){ cur[j][k][l] = 0; } } } for(int j = 0;j <= i;j++){ for(int k = 0;k < 2;k++){ // 3個上以上:切断しない, 2-4:切断しない, 1-3:切断しない, 0-2:なにもない if(i+1-j-(2-k) >= 0){ cur[j][0][0] += pre[j][k][0] * (i+1-j-(2-k)); cur[j][0][0] %= mod; } if(i+1-j-(2-k) >= 0){ cur[j][1][0] += pre[j][k][1] * (i+1-j-(2-k)); cur[j][1][0] %= mod; } // 3個上以上:切断する, 2-4:切断しない, 1-3:切断しない, 0-2:なにもない if(j-1 >= 0){ cur[j-1][0][0] += pre[j][k][0] * (j-k-0); cur[j-1][0][0] %= mod; cur[j-1][1][0] += pre[j][k][1] * (j-k-1); cur[j-1][1][0] %= mod; } // 3個上以上:切断しない, 2-4:切断する, 1-3:切断しない, 0-2:結合する if(k == 1 && j >= 1){ cur[j][0][1] += pre[j][k][0]; if(cur[j][0][1] >= mod)cur[j][0][1] -= mod; cur[j][1][1] += pre[j][k][1]; if(cur[j][1][1] >= mod)cur[j][1][1] -= mod; } // 3個上以上:切断しない, 2-4:切断しない, 1-3:切断しない, 0-2:結合する if(j+1 <= n){ cur[j+1][0][1] += pre[j][k][0] * (2-k); cur[j+1][0][1] %= mod; cur[j+1][1][1] += pre[j][k][1] * (2-k); cur[j+1][1][1] %= mod; } // 3個上以上:切断しない, 2-4:切断しない, 1-3:切断する, 0-2:なにもない if(j-1 >= 0){ cur[j-1][0][0] += pre[j][k][1]; cur[j-1][0][0] %= mod; } } } long[][][] dum = pre; pre = cur; cur = dum; } return pre[0][0][0]; } static boolean nextPermutation(int[] src) { int i; for (i = src.length - 2; i >= 0 && src[i] > src[i + 1]; i--) ; if (i == -1) return false; int j; for (j = i + 1; j < src.length && src[i] < src[j]; j++) ; int d = src[i]; src[i] = src[j - 1]; src[j - 1] = d; for (int p = i + 1, q = src.length - 1; p < q; p++, q--) { d = src[p]; src[p] = src[q]; src[q] = d; } return true; } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solve(); out.flush(); long G = System.currentTimeMillis(); tr(G-S+"ms"); } private static boolean eof() { if(lenbuf == -1)return true; int lptr = ptrbuf; while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false; try { is.mark(1000); while(true){ int b = is.read(); if(b == -1){ is.reset(); return true; }else if(!isSpaceChar(b)){ is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private static char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private static int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private static int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }