@memo={1=>1, 2=>2} def comb grid return @memo[grid] if @memo[grid] return @memo[grid] = comb(grid - 2) + comb(grid - 1) end n=gets.to_i p comb n