1.

/**
* Angewandte Mathematik, SS11
* Problem: 10127 Ones
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1068
* @author Unverzahrt Michael
* @author Wurth Manuel
* @version 1.0, 11/05/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.664
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
public static void main(String[] args) throws Exception {
String inputLine;
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
while ((inputLine = reader.readLine()) != null) {
BigInteger n = new BigInteger(inputLine);
BigInteger a = BigInteger.ONE;
BigInteger t = BigInteger.ZERO;

while ((a.mod(n)) != BigInteger.ZERO) {
a = (a.multiply(BigInteger.valueOf(10))).add(BigInteger.ONE);
t=t.add(BigInteger.ONE);
}

System.out.println(t.add(BigInteger.ONE));
n = BigInteger.ZERO;
}
}
}