CodeEff/ECCO huggingface dataset:
# Original solution
import bisect
a,b,q = list(map(int,input().split()))
s = [-10**11]+[int(eval(input())) for _ in range(a)]+[10**11]
t = [-10**11]+[int(eval(input())) for _ in range(b)]+[10**11]
for i in range(q):
  ans = 10**11
  x = int(eval(input()))
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      S += (now-arr[j][i >> j & 1])*(-1)**(((now-arr[j][i >> j & 1])<0))
      now = arr[j][i >> j & 1]
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      S += (now-arr[1-j][i >> j & 1])*((-1)**((now-arr[1-j][i >> j & 1])<0))
      now = arr[1-j][i >> j & 1]
    if ans > S:
      ans = S
  print(ans)

# Optimized solution
import bisect
a,b,q = list(map(int,input().split()))
s = [-10**11]+[int(eval(input())) for _ in range(a)]+[10**11]
t = [-10**11]+[int(eval(input())) for _ in range(b)]+[10**11]
for i in range(q):
  ans = 10**11
  x = int(eval(input()))
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  print(ans)
# Original solution
import bisect
from itertools import product
I = lambda n: [int(eval(input())) for _ in range(n)]
def f(S, x):
    p = bisect.bisect_left(S, x)
    return [S[p-1], S[p]]
g = lambda x, s, t: abs(x-s)+abs(s-t)
INF = 10**11
a, b, q = list(map(int, input().split()))
S, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)
for x in X:
    min_ = INF
    for s, t in product(f(S, x), f(T, x)):
        min_ = min(min_, g(x, s, t), g(x, t, s))
    print(min_)

# Optimized solution
from bisect import bisect_left
from itertools import product
I = lambda n: [int(eval(input())) for _ in range(n)]
def f(S, x):
    p = bisect_left(S, x)
    return [S[p-1], S[p]]
g = lambda x, s, t: abs(x-s)+abs(s-t)
INF = 10**11
a, b, q = list(map(int, input().split()))
S, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)
for x in X:
    min_ = INF
    for s, t in product(f(S, x), f(T, x)):
        min_ = min(min_, g(x, s, t), g(x, t, s))
    print(min_)
# Original solution
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = list(map(int, readline().split()))
    S = [int(readline()) for _ in range(A)]
    T = [int(readline()) for _ in range(B)]
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    vs = [0] * 2
    vt = [0] * 2
    for i, x in enumerate(X):
        idx_s = bisect_left(S, x)
        idx_t = bisect_left(T, x)

        vs[0] = S[idx_s - 1] if idx_s > 0 else -INF
        vt[0] = T[idx_t - 1] if idx_t > 0 else -INF
        vs[1] = S[idx_s] if idx_s < A else INF
        vt[1] = T[idx_t] if idx_t < B else INF

        for s in vs:
            for t in vt:
                ans[i] = min(ans[i], abs(x - s) + abs(s - t), abs(x - t) + abs(t - s))

    print(('\n'.join(map(str, ans))))

    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = list(map(int, readline().split()))
    S = [-INF] + [int(readline()) for _ in range(A)] + [INF]
    T = [-INF] + [int(readline()) for _ in range(B)] + [INF]
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    for i, x in enumerate(X):
        idx_s = bisect_left(S, x)
        idx_t = bisect_left(T, x)

        for s in (S[idx_s - 1], S[idx_s]):
            for t in (T[idx_t - 1], T[idx_t]):
                ans[i] = min(ans[i], abs(x - s) + abs(s - t), abs(x - t) + abs(t - s))

    print(('\n'.join(map(str, ans))))

    return


if __name__ == '__main__':
    main()
# Original solution
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = list(map(int, readline().split()))
    S = [-INF] + [int(readline()) for _ in range(A)] + [INF]
    T = [-INF] + [int(readline()) for _ in range(B)] + [INF]
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    for i, x in enumerate(X):
        idx_s = bisect_left(S, x)
        idx_t = bisect_left(T, x)

        for s in (S[idx_s - 1], S[idx_s]):
            for t in (T[idx_t - 1], T[idx_t]):
                ans[i] = min(ans[i], abs(x - s) + abs(s - t), abs(x - t) + abs(t - s))

    print(('\n'.join(map(str, ans))))

    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = list(map(int, readline().split()))
    S = [-INF]
    S.extend(int(readline()) for _ in range(A))
    S.append(INF)
    T = [-INF]
    T.extend(int(readline()) for _ in range(B))
    T.append(INF)
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    for i, x in enumerate(X):
        idx_s = bisect_left(S, x)
        idx_t = bisect_left(T, x)

        for s in (S[idx_s - 1], S[idx_s]):
            for t in (T[idx_t - 1], T[idx_t]):
                ans[i] = min(ans[i], abs(x - s) + abs(s - t), abs(x - t) + abs(t - s))

    print(('\n'.join(map(str, ans))))

    return


if __name__ == '__main__':
    main()
# Original solution
a,b,q=list(map(int,input().split()))
S,T=[],[]
for i in range(a):
  S.append(int(eval(input())))
for i in range(b):
  T.append(int(eval(input())))
def f(list,n):
  if n<list[0]:
    return [-float("inf"),list[0]]
  elif list[-1]<n:
    return [list[-1],float("inf")]
  else:
    flag,count=0,0
    l=len(list)
    i=(l-1)//2
    while flag==0:
      if list[i]<n<list[i+1]:
        flag=1
        return [list[i],list[i+1]]
      elif n<list[i]:
        i//=2
        count+=1
      else:
        i+=(l-1)//(2**(count+1))
        count+=1
def g(SS,TT,x):
  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x
  dis1=max(a,c)
  dis2=min(2*a+d,2*d+a)
  dis3=max(b,d)
  dis4=min(2*b+c,2*c+b)
  return min([dis1,dis2,dis3,dis4])
        
for i in range(q):
  x=int(eval(input()))
  print((g(f(S,x),f(T,x),x)))

# Optimized solution
import bisect
a,b,q=list(map(int,input().split()))
S,T=[],[]
for i in range(a):
  S.append(int(eval(input())))
for i in range(b):
  T.append(int(eval(input())))
def f(list,n):
  if n<list[0]:
    return [-float("inf"),list[0]]
  elif list[-1]<n:
    return [list[-1],float("inf")]
  else:
    i=bisect.bisect_left(list,n)
    return [list[i-1],list[i]]
def g(SS,TT,x):
  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x
  dis1=max(a,c)
  dis2=min(2*a+d,2*d+a)
  dis3=max(b,d)
  dis4=min(2*b+c,2*c+b)
  return min([dis1,dis2,dis3,dis4])
for i in range(q):
  x=int(eval(input()))
  print((g(f(S,x),f(T,x),x)))
# Original solution
import bisect
a, b, q = list(map(int, input().split()))
inf = float('inf')
S = [- inf] + [int(eval(input())) for i in range(a)] + [inf]
T = [- inf] + [int(eval(input())) for i in range(b)] + [inf]

for i in range(q):
    x = int(eval(input()))
    s_idx = bisect.bisect_left(S, x)
    s1, s2 = S[s_idx - 1], S[s_idx]
    
    t_idx = bisect.bisect_left(T, x)
    t1, t2 = T[t_idx - 1], T[t_idx]
    
    ans = inf
    for i in s1, s2, t1, t2:
        for j in s1, s2, t1, t2:
            if i != j:
                tmp = abs(x - i) + abs(i - j)
                ans = min(ans, tmp)
                
    print(ans)

# Optimized solution
import bisect
a, b, q = list(map(int, input().split()))
inf = float('inf')
S = [- inf] + [int(eval(input())) for i in range(a)] + [inf]
T = [- inf] + [int(eval(input())) for i in range(b)] + [inf]

for i in range(q):
    x = int(eval(input()))
    s_idx = bisect.bisect_left(S, x)
    s1, s2 = S[s_idx - 1], S[s_idx]
    
    t_idx = bisect.bisect_left(T, x)
    t1, t2 = T[t_idx - 1], T[t_idx]
    
    ans = inf
    for i in s1, s2:
        for j in t1, t2:
            ans = min(ans, abs(x - i) + abs(i - j))
            ans = min(ans, abs(x - j) + abs(i - j))
                
    print(ans)
# Original solution
from bisect import bisect_left
A,B,Q = list(map(int,input().split()))
inf = float('inf')
S = [-inf] + [int(eval(input())) for i in range(A)] + [inf]
T = [-inf] + [int(eval(input())) for i in range(B)] + [inf]
X = [int(eval(input())) for i in range(Q)]
for x in X:
    si = bisect_left(S,x); ti = bisect_left(T,x)
    ans = inf
    for s in [S[si-1],S[si]]:
        for t in [T[ti-1],T[ti]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min(ans,d1,d2)
    print(ans)

# Optimized solution
import sys
input = sys.stdin.readline

from bisect import bisect

inf = float('inf')

A,B,Q = list(map(int,input().split()))
S = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]
T = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]
X = [int(eval(input())) for _ in range(Q)]

for x in X:
    ans = inf
    si = bisect(S,x)
    ti = bisect(T,x)
    for s in [S[si-1],S[si]]:
        for t in [T[ti-1],T[ti]]:
            res = abs(s-t) + min(abs(x-s),abs(x-t))
            ans = min(ans,res)
    print(ans)
# Original solution
import sys
import bisect
input = sys.stdin.readline

A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []

for x in query:
    tl = bisect.bisect_left(tera, x)
    tr = bisect.bisect_right(tera, x)
    sl = bisect.bisect_left(sha, x)
    sr = bisect.bisect_right(sha, x)

    if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl-1], tera[tl]]

    if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl-1], sha[sl]]

    ans = 10**18
    for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
    res.append(ans)

print(*res, sep="\n")


# Optimized solution
import sys
import bisect
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
bl = bisect.bisect_left

A, B, Q = list(map(int, input().split()))
inf = 10**18
S = [-inf]+[int(eval(input())) for _ in range(A)]+[inf]
T = [-inf]+[int(eval(input())) for _ in range(B)]+[inf]


def path(x):
    sl = S[bl(S, x) - 1]
    sr = S[bl(S, x)]
    tl = T[bl(T, x) - 1]
    tr = T[bl(T, x)]

    res = 10 ** 18
    res = min(res, abs(x - sl) + abs(sl - tl))
    res = min(res, abs(x - sl) + abs(sl - tr))
    res = min(res, abs(x - sr) + abs(sr - tr))
    res = min(res, abs(x - sr) + abs(sr - tl))
    res = min(res, abs(x - tr) + abs(tr - sl))
    res = min(res, abs(x - tr) + abs(tr - sr))
    res = min(res, abs(x - tl) + abs(tl - sl))
    res = min(res, abs(x - tl) + abs(tl - sr))
    return res


X = [int(eval(input())) for _ in range(Q)]
for x in X:
    print((path(x)))
# Original solution
def dfs(p, c, s):
    if c==n:
        return not s
    if p==-1:
        return 0
    if memo[s][p][c] != -1:
        return memo[s][p][c]
    ret = 0
    for i in range(min(p, s), -1, -1):
        ret += dfs(i-1, c+1, s-i)
    memo[s][p][c] = ret
    return ret

while 1:
    n, s = list(map(int, input().split()))
    if n==0:
        break
    memo = [[[-1]*(n+1) for i in range(101)] for j in range(s+1)]
    print(dfs(min(s, 100), 0, s))

# Optimized solution
while 1:
    n, s = list(map(int, input().split()))
    if n==0:
        exit(0)
    dp = [[0]*(s+1) for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(min(s+1, 101)):
        si1 = s-i+1
        for k in range(n, 0, -1):
            dp_k = dp[k]; dp_k1 = dp[k-1]
            for j in range(si1):
                dp_k[i+j] += dp_k1[j]
    print(dp[n][s])
# Original solution
"""
now...今注目する値
used...使った数字の数
sum...それまでの合計

dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数
dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now)
                     dp[now - 1][used][sum]                                    (used == 0  or  sum < now)
"""
dp = [[[0 for _ in range(1001)] for _ in range(10)] for _ in range(101)]
dp[0][1][0] = 1
dp[0][0][0] = 1

for now in range(1, 101):
  for used in range(10):
    for s in range(1001):
      if used >= 1 and s >= now:
        dp[now][used][s] = dp[now - 1][used - 1][s - now] + dp[now - 1][used][s]
      else:
        dp[now][used][s] = dp[now - 1][used][s]

while True:
  n, s = list(map(int, input().split()))
  if not n:
    break
  print((dp[100][n][s]))


# Optimized solution
"""
now...今注目する値
used...使った数字の数
sum...それまでの合計

dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数

dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now)
                     dp[now - 1][used][sum]                                    (used == 0  or  sum < now)


2次元化

dp[used][sum]...used個の数字を使って合計sumの場合の数

dp[used][sum] = dp[used - 1][sum - now] + dp[used][sum] (used >= 1 and sum >= now)

ただし、usedの大きい順に更新する(更新がかぶるため)
"""

dp = [[0 for _ in range(1001)] for _ in range(10)]
dp[1][0] = 1
dp[0][0] = 1

for now in range(1, 101):
  for used in range(9, 0, -1):
    for s in range(now, 1001):
      dp[used][s] = dp[used - 1][s - now] + dp[used][s]

while True:
  n, s = list(map(int, input().split()))
  if not n:
    break
  print((dp[n][s]))
# Original solution
"""
now...今注目する値
used...使った数字の数
sum...それまでの合計

dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数

dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now)
                     dp[now - 1][used][sum]                                    (used == 0  or  sum < now)


2次元化

dp[used][sum]...used個の数字を使って合計sumの場合の数

dp[used][sum] = dp[used - 1][sum - now] + dp[used][sum] (used >= 1 and sum >= now)

ただし、usedの大きい順に更新する(更新がかぶるため)
"""

dp = [[0 for _ in range(1001)] for _ in range(10)]
dp[1][0] = 1
dp[0][0] = 1

for now in range(1, 101):
  for used in range(9, 0, -1):
    for s in range(now, 1001):
      dp[used][s] = dp[used - 1][s - now] + dp[used][s]

while True:
  n, s = list(map(int, input().split()))
  if not n:
    break
  print((dp[n][s]))


# Optimized solution
dp = [[0 for _ in range(1001)] for _ in range(10)]
dp[1][0] = dp[0][0] = 1

for now in range(1, 101):
  for used in range(9, 0, -1):
    dpu = dp[used]
    dpu_1 = dp[used - 1]
    for s in range(now, 1001):
      dpu[s] = dpu_1[s - now] + dpu[s]

while True:
  n, s = list(map(int, input().split()))
  if not n:
    break
  print((dp[n][s]))
# Original solution
m=1001
A=list(range(9))
d=[[0]*m for i in A]
for i in range(101):
  for j in A[::-1]:
    if j==0: d[j][i]=1
    else:
      for k in range(m):
        if k+i<m: d[j][k+i]+=d[j-1][k]
while 1:
  n,s=list(map(int,input().split()))
  if n==s==0: break
  print(d[n-1][s])

# Optimized solution
m=1001
A=list(range(9))
d=[[0]*m for i in A]
for i in range(101):
  for j in A[::-1]:
    if j==0: d[j][i]=1
    else:
      for k in range(m-i): d[j][k+i]+=d[j-1][k]
while 1:
  n,s=list(map(int,input().split()))
  if n==s==0: break
  print(d[n-1][s])
# Original solution
m=1001
A=list(range(10))
d=[[0]*m for i in A]
d[0][0]=1
for i in range(101):
  for j in A[1:][::-1]:
    for k in range(m-i): d[j][k+i]+=d[j-1][k]
while 1:
  n,s=list(map(int,input().split()))
  if n==s==0: break
  print(d[n][s])

# Optimized solution
m=1001
A=list(range(9))
d=[[0]*m for i in A]
for i in range(101):
  for j in A[1:][::-1]:
    for k in range(m-i): d[j][k+i]+=d[j-1][k]
  d[0][i]=1
while 1:
  n,s=list(map(int,input().split()))
  if n==s==0: break
  print(d[n-1][s])
# Original solution
while 1:
	try:
		N,M = list(map(int,input().split()))
		dp = [[0]*(M+1) for i in range(3)]
		for _ in range(N):
			name = input()
			C,V,D,L = list(map(int,input().split()))
			VDL = [V,D,L]
			for i in range(3):
				try: dp[i][C] = max(dp[i][C],VDL[i])
				except: pass
				for j in range(M):
					if dp[i][j]:
						try: dp[i][j+C] = max(dp[i][j+C],dp[i][j]+VDL[i])
						except: break
		print(max(max(dp[0]),max(dp[1]),max(dp[2])))
	except:
		break

# Optimized solution
while 1:
	try:
		N,M = list(map(int,input().split()))
		dp = [[0]*(M+1) for i in range(3)]
		for _ in range(N):
			name = input()
			C,V,D,L = list(map(int,input().split()))
			VDL = [V,D,L]
			for i in range(3):
				try: dp[i][C] = max(dp[i][C],VDL[i])
				except: break
				for j in range(M):
					if dp[i][j]:
						try: dp[i][j+C] = max(dp[i][j+C],dp[i][j]+VDL[i])
						except: break
		print(max(max(dp[0]),max(dp[1]),max(dp[2])))
	except:
		break
# Original solution
import math

def main():
    X = int(eval(input()))
    ans = False
    for i in range(X+1):
        mx = 105 * i
        mn = 100 * i
        if mn <= X <= mx:
            ans = True
    if ans:
        print((1))
    else:
        print((0))

if __name__ == "__main__":
    main()

# Optimized solution
import math

def main():
    X = int(eval(input()))
    # ans = False
    c = X // 100
    mx = 105 * c
    mn = 100 * c
    if mn <= X <= mx:
        print((1))
    else:
        print((0))

if __name__ == "__main__":
    main()
# Original solution
x = int(eval(input()))

max_a = (x // 100) + 1
max_b = (x // 101) + 1
max_c = (x // 102) + 1
max_d = (x // 103) + 1
max_e = (x // 104) + 1

for a in range(max_a):
  for b in range(max_b):
    for c in range(max_c):
      for d in range(max_d):
        for e in range(max_e):
          for_f = x - (a * 100 + b * 101 + c * 102 + d * 103 + e * 104)
          if for_f >= 0 and for_f % 105 == 0:
            # print(a, b, c, d, e, for_f // 105)
            print('1')
            exit(0)
print('0')


# Optimized solution
x = int(eval(input()))
c = int(x / 100)
# print(c)

for i in range(c * 100, c * 105 + 1):
  if i == x:
    print((1))
    exit(0)
print((0))
# Original solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [[False]*(X+1) for _ in range(7)]
    price = [100,101,102,103,104,105]

    for i in range(7):
        dp[i][0] = True

    ## i番目まででjを払えるか
    for i in range(6):
        for j in range(X+1):
            if j >= price[i]:
                for k in range(1,j//price[i]+1):
                    dp[i+1][j] |= dp[i][j] or dp[i][j-k*price[i]]
            else:
                dp[i+1][j] = dp[i][j]

    if dp[6][X]:
        print((1))
    else:
        print((0))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [[-1]*(X+1) for _ in range(7)]
    price = [100,101,102,103,104,105]
    m = [10**5]*6

    for i in range(7):
        dp[i][0] = 10**5

    ## i番目まででjを払えるか
    for i in range(6):
        for j in range(X+1):
            if dp[i][j]>=0:
                dp[i+1][j] = m[i]
            elif j < price[i] or dp[i+1][j-price[i]]<=0:
                dp[i+1][j] = -1
            else:
                dp[i+1][j] = dp[i+1][j-price[i]]-1

    if dp[6][X]>=0:
        print((1))
    else:
        print((0))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()
# Original solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [[-1]*(X+1) for _ in range(7)]
    price = [100,101,102,103,104,105]
    m = [10**5]*6

    for i in range(7):
        dp[i][0] = 10**5

    ## i番目まででjを払えるか
    for i in range(6):
        for j in range(X+1):
            if dp[i][j]>=0:
                dp[i+1][j] = m[i]
            elif j < price[i] or dp[i+1][j-price[i]]<=0:
                dp[i+1][j] = -1
            else:
                dp[i+1][j] = dp[i+1][j-price[i]]-1

    if dp[6][X]>=0:
        print((1))
    else:
        print((0))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [False for _ in range(X+1)]
    dp[0] = True
    prices = [100,101,102,103,104,105]
    for i in range(1,X+1):
        for price in prices:
            if i >= price:
                if dp[i-price]:
                    dp[i] = dp[i-price]
                    break
    
    print((int(dp[X])))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()
# Original solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [False for _ in range(X+1)]
    dp[0] = True
    prices = [100,101,102,103,104,105]
    for i in range(1,X+1):
        for price in prices:
            if i >= price:
                if dp[i-price]:
                    dp[i] = dp[i-price]
                    break
    
    print((int(dp[X])))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(X: int):
    for i in range(1000):
        if i*100 <= X <= i*105:
            print((1))
            return 
    
    print((0))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()
# Original solution
import sys
input = sys.stdin.readline
from collections import *

X = int(eval(input()))
dp = [False]*(X+1)
dp[0] = True

for i in range(X+1):
    for j in range(100, 106):
        if i-j>=0:
            dp[i] |= dp[i-j]

if dp[X]:
    print((1))
else:
    print((0))

# Optimized solution
X = int(eval(input()))
dp = [False]*(X+1)
dp[0] = True

for i in range(X+1):
    for j in range(100, 106):
        if i+j<=X:
            dp[i+j] |= dp[i]

if dp[X]:
    print((1))
else:
    print((0))
# Original solution
X = int(eval(input()))

dp = [-1] * (X + 1)
a = [100, 101, 102, 103, 104, 105]
m = [1000000] * 6
dp[0] = 0
for i in range(6):
    for j in range(X + 1):
        if dp[j] >= 0:
            dp[j] = m[i]
        elif j < a[i] or dp[j - a[i]] <= 0:
            dp[j] = -1
        else:
            dp[j] = dp[j - a[i]] - 1
            
print((int(dp[-1] >= 0)))


# Optimized solution

X = int(eval(input()))

n = X % 100
m = X // 100

cnt = 0
for a in reversed(list(range(1, 6))):
    while n - a >= 0:
        n -= a
        cnt += 1

if cnt <= m:
    print((1))
else:
    print((0))
# Original solution
n = int(eval(input()))
 
ans = 0
for i in range(1, n+1):
  if n in list(range(100 * i, 105 * i + 1)):
    ans = 1
print(ans)


# Optimized solution
x = int(eval(input()))

flag = False
for c in range(1,x+1):
  if c * 100 <= x and x <= c * 105:
    flag = True
    break
print((1 if flag else 0))