Codeforces Beta Round 64
C
Lucky Tickets
Codeforces
2200
原题
← BD →
翻译中…

In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by $*a*$ and the ticket number — by $*b*$, then a ticket is described by the ordered pair of numbers $(*a*, *b*)$.

翻译中…

The walruses believe that a ticket is lucky if $*a* * *b* = *rev*(*a*) * *rev*(*b*)$. The function $*rev*(*x*)$ reverses a number written in the decimal system, at that the leading zeroes disappear. For example, $*rev*(12343) = 34321$, $*rev*(1200) = 21$.

翻译中…

The Public Transport Management Committee wants to release $*x*$ series, each containing $*y*$ tickets, so that at least $*w*$ lucky tickets were released and the total number of released tickets ($*x* * *y*$) were minimum. The series are numbered from $1$ to $*x*$ inclusive. The tickets in each series are numbered from $1$ to $*y*$ inclusive. The Transport Committee cannot release more than $*max*_{*x*}$ series and more than $*max*_{*y*}$ tickets in one series.

翻译中…

Input

翻译中…

The first line contains three integers $*max*_{*x*}$, $*max*_{*y*}$, $*w*$ ($1 ≤ *max*_{*x*}, *max*_{*y*} ≤ 10^{5}$, $1 ≤ *w* ≤ 10^{7}$).

翻译中…

Output

翻译中…

Print on a single line two space-separated numbers, the $*x*$ and the $*y*$. If there are several possible variants, print any of them. If such $*x*$ and $*y*$ do not exist, print a single number $- 1$.

翻译中…

样例

Input #1
2 2 1
Output #1
1 1
InputCopy OutputCopy
Input #2
132 10 35
Output #2
7 5
InputCopy OutputCopy
Input #3
5 18 1000
Output #3
-1
InputCopy OutputCopy
Input #4
48 132 235
Output #4
22 111
InputCopy OutputCopy
题目信息
题号
70C
时间限制
1.5 s
内存限制
256 MB
标签
二分
数据结构
排序
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。