from collections import deque
a,b=map(int,input().split())
vis = [False] * 41
q = deque()
q.append((a,0))
vis[a] = True
while q:
n , c = q.popleft()
if n == b:
print(c)
break
for next in [n + 1, n - 1, n + 5, n - 5, n + 10, n - 10]:
if 0 <= next <= 40 and not vis[next]:
vis[next] = True
q.append((next, c + 1))
To embed this project on your website, copy the following code and paste it into your website's HTML: