1107

    1107번 파이썬

    import sys input = sys.stdin.readline N = int(input()) M = int(input()) res = abs(100-N) if M: c_err = input().split() else: c_err=[] for num in range(1000001): solved=True for c in str(num): if c in c_err: solved=False break if solved: res=min(res,len(str(num))+abs(N-num)) print(res)