MODE = "stdio" #require 'matrix' #include Math line = Array.new if(defined? MODE) line = STDIN.read.split("\n") else tmp = '12'.split("\n") tmp.each{|s| line << s.strip } end n = line[0].to_i puts ((1+3**(1.0/2))**n).to_i%1000