

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 500 点
問題文
整数 N が与えられます.
1
, 2
, \cdots, 9
からなる文字列 s であって,以下の条件を満たすものを一つ求めてください.
- s の長さ |s| は 10^6 以下.
- 次の条件を満たす整数の組 (l,r) (1 \leq l \leq r \leq |s|) の個数がちょうど N である.
- s の l 文字目から r 文字目までを取り出して数として見たとき,7 で割り切れる.
なお,この問題の制約より,解が必ず存在することが証明できます.
制約
- 1 \leq N \leq 10^6
- 入力される値はすべて整数である
入力
入力は以下の形式で標準入力から与えられる.
N
出力
条件を満たす s を出力せよ. 解が複数存在する場合,どれを出力しても正解とみなされる.
入力例 1
2
出力例 1
142
(l,r)=(1,2),(2,3) の 2 つが条件を満たします.
入力例 2
3
出力例 2
77
(l,r)=(1,1),(2,2),(1,2) の 3 つが条件を満たします.
Score : 500 points
Problem Statement
Given is an integer N.
Find one string s consisting of 1
, 2
, \cdots, 9
that satisfies the conditions below.
- The length of s, |s|, is at most 10^6.
- There are exactly N pairs of integers (l,r) (1 \leq l \leq r \leq |s|) that satisfy the following condition.
- When the l-th through r-th characters of s are extracted and seen as a number, it is divisible by 7.
Under the Constraints of this problem, we can prove that a solution always exists.
Constraints
- 1 \leq N \leq 10^6
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
Output
Print a string s that satisfies the conditions. If multiple solutions exist, printing any of them would be accepted.
Sample Input 1
2
Sample Output 1
142
Two pairs (l,r)=(1,2),(2,3) satisfy the conditions.
Sample Input 2
3
Sample Output 2
77
Three pairs (l,r)=(1,1),(2,2),(1,2) satisfy the conditions.