#!/usr/bin/python
import sys
import math
factor = 2
if len(sys.argv) > 1:
factor = float(sys.argv[1])
# read sparse matrix
cur = 0
nxt = 1
last = 0
for line in sys.stdin:
last = line
cur = cur + 1
if cur >= nxt:
sys.stdout.write(line)
nxt = math.ceil(nxt * factor)
last = 0
if last != 0:
sys.stdout.write(last)