MOD = 1000000007 $dp = 222.times.map { 222.times.map { nil } } def rec a, b $dp[a][b] ||= [a, b].min == 1 ? 1 : rec(a, b-1) + rec(a-1, b) % MOD end ls = readlines raise unless ls.size == 1 n = ls[0] raise unless n == "0\n" || n =~ /^[1-9][0-9]*$/ n = ls[0].to_i ans = 0 1.upto(n-1) { |i| 1.upto(n-1) { |j| 1.upto(n-1) { |k| ans += rec(n - i, j) * rec(n - j, k) * rec(n - k, i) % MOD }}} ans += rec(n - 1, n*2 - 1) * 3 p ans % MOD