N = gets.to_i
A = (0...N).map{ rand(1..10**3) }
B = A.dup
m = 0
rand(1..2*N).times{
  i = rand(0...N)
  n = rand(1..1000)
  v = B[i] + n * (B[(i-1) % N] + B[(i+1) % N])
  next if v > 10**9
  B[i] = v
  m += n
}
$stderr.puts m
puts N, A*" ", B*" "