There is a string S consisting of digits 1, 2, ..., 9.
Lunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)
The master's favorite number is 753. The closer to this number, the better.
What is the minimum possible (absolute) difference between X and 753?

-----Constraints-----
 - S is a string of length between 4 and 10 (inclusive).
 - Each character in S is 1, 2, ..., or 9.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
Print the minimum possible difference between X and 753.

-----Sample Input-----
1234567876

-----Sample Output-----
34

Taking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.
Note that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.
We cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.
[{"code": "S=input()\na=1145141919810\nfor i in range(len(S)-2):\n  a=min(a,abs(753-int(S[i:i+3])))\nprint(a)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "S = input()\nmin = 1000\nfor i in range(len(S) - 2):\n\tx = int(S[i:i+3])\n\tx = abs(753 - x)\n\tif min > x:\n\t\tmin = x\nprint(min)", "passed": true, "time": 0.89, "memory": 14412.0, "status": "done"}, {"code": "s = input()\n\ny = []\nfor i in range(1, len(s) - 1):\n    x = int(s[i - 1: i + 2])\n    y.append(abs(x - 753))\n\nprint(min(y))", "passed": true, "time": 0.24, "memory": 14196.0, "status": "done"}, {"code": "s = input()\n\nans = 999\nfor i in range(len(s) - 2):\n    x = int(s[i:i + 3])\n    diff = abs(753 - x)\n    ans = min(diff, ans)\n\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14168.0, "status": "done"}, {"code": "S=input()\nx=len(S)\ny=[]\nfor n in range(x):\n  y.append(abs(753-int(S[n:n+3])))\ny.sort()\nprint(y[0])", "passed": true, "time": 0.15, "memory": 14392.0, "status": "done"}, {"code": "s = input()\nans = 10**8\nfor i in range(len(s)-2):\n  ans = min(ans, abs(753-int(s[i:i+3])))\nprint(ans)", "passed": true, "time": 0.18, "memory": 14304.0, "status": "done"}, {"code": "# abc114b\n# https://atcoder.jp/contests/abc114/tasks/abc114_b\n\n# \u6570\u5b571,2...9\u304b\u3089\u306a\u308b\u6587\u5b57\u5217S\n# S\u304b\u3089\u9023\u7d9a\u3059\u308b3\u500b\u306e\u6570\u5b57\u3092\u53d6\u308a\u51fa\u3057\u30011\u3064\u306e\u6574\u6570X\u3068\u3059\u308b\n\n# X\u3068753\u306e\u5dee\uff08\u306e\u7d76\u5bfe\u5024\uff09\u306f\u6700\u5c0f\u3067\u3044\u304f\u3064\u306b\u306a\u308b\u304b\uff1f\n# \u203b\u4e26\u3073\u66ff\u3048\u306f\u51fa\u6765\u306a\u3044\n\n# abs:\u7d76\u5bfe\u5024\u3082\u3068\u3081\u308b\u95a2\u6570\n# min:\u6700\u5c0f\u5024\u3082\u3068\u3081\u308b\u95a2\u6570\n\n# \u5165\u529b\ns = str(input())\n\n# \u51e6\u7406\n# X\u3068753\u306e\u5dee\u306e\u7d76\u5bfe\u5024\u306e\u683c\u7d0d\nabs_list = []\n\nfor i in range(1, len(s) - 1):\n    # S\u306ei\u756a\u76ee\u304b\u30893\u3064\u9806\u756a\u306b\u53d6\u5f97\n    x = int(s[i - 1: i + 2])\n    # 753\u3068\u306e\u5dee\n    abs_list.append(abs(x - 753))\n\n# \u30ea\u30b9\u30c8\u306b\u5165\u308c\u305f\u3082\u306e\u306e\u6700\u5c0f\u5024\nanswer = min(abs_list)\nprint(answer)\n", "passed": true, "time": 0.19, "memory": 14196.0, "status": "done"}, {"code": "s=str(input())\nans=99999999999\nfor i in range(len(s)-2):\n    n=int(s[i:i+3])\n    if abs(753-n) < ans:\n        ans=abs(753-n)\nprint(ans)\n", "passed": true, "time": 0.24, "memory": 14172.0, "status": "done"}, {"code": "s = input()\nli = []\nfor i in range(1,len(s)-1):\n    if int(s[i-1:i+2]) >= 753:\n        li.append(int(s[i-1:i+2])-753)\n    else:\n       li.append((753-int(s[i-1:i+2])))\n\nprint(min(li))", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "S = input()\nN = len(S)\nnum = 753\n\nres = 10**10\nfor i in range(N - 2):\n    res = min(res, abs(int(S[i:i+3]) - num))\n\nprint(res)", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "def check(num_str: str) -> int:\n    n = len(num_str)\n    diff_lists = []\n    for i in range(0, n - 2):\n        diff_lists.append(abs(int(num_str[i] + num_str[i + 1] + num_str[i + 2]) - 753))\n    diff_lists.sort()\n\n    return (diff_lists[0])\n\n\ndef __starting_point():\n    s = input()\n    print((check(s)))\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14160.0, "status": "done"}, {"code": "S = input()\n\nlst = []\nans = 1000\nfor n in range(3, len(S)+1):\n    i = int(S[n-3:n])\n    lst.append(i)\n\nfor m in lst:\n    d = abs(753 - m)\n    if ans > d:\n        ans = d\n    \nprint(ans)", "passed": true, "time": 0.18, "memory": 14352.0, "status": "done"}, {"code": "s = input()\n\narr = []\n\nfor i in range(0, len(s) - 2):\n    arr.append(abs(753 - int(str(s[i]) + str(s[i + 1]) + str(s[i + 2]))))\n\nprint(min(arr))", "passed": true, "time": 0.15, "memory": 14232.0, "status": "done"}, {"code": "# 29\nS = str(input())\n\nans = 100000\ni = 0\nwhile i < len(S) - 2:\n    x = int(str(S[i]) + str(S[i + 1]) + str(S[i + 2]))\n    ans = min(ans, abs(753 - x))\n    i += 1\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14196.0, "status": "done"}, {"code": "S=input()\nans = 754\nfor i in range(len(S)-2):\n  ans = min(ans,abs(753-int(S[i:i+3])))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "def answer(s: str) -> int:\n    return min(abs(753 - int(s[i:i + 3])) for i in range(len(s) - 2))\n\n\ndef main():\n    s = input()\n    print(answer(s))\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.2, "memory": 14272.0, "status": "done"}, {"code": "S = input()\n\nans = 753\nfor i in range(len(S) - 2):\n    x = int(S[i:i + 3])\n    dif = abs(x - 753)\n    ans = min(ans, dif)\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14196.0, "status": "done"}, {"code": "s = input()\n\ny = []\nfor i in range(1 , len(s) - 1):\n    x = int(s[i - 1:i + 2])\n    y.append(abs(x - 753))\nprint((min(y)))\n\n", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "S = input()\n\nS_list = []\nfor i in range(len(S) - 2):\n    dif = abs(int(S[i] + S[i + 1] + S[i + 2]) - 753)\n    S_list.append(dif)\n\nans = min(S_list)\n\nprint(ans)", "passed": true, "time": 0.21, "memory": 14332.0, "status": "done"}, {"code": "s=list(map(str,input()))\n\nans=753-111 #\u6700\u5927\u5024\nfor i in range(len(s)-2):\n\ttotal=s[i]+s[i+1]+s[i+2]\n\tnew=abs(753-int(total))\n\tans=min(ans,new)\n\t\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14284.0, "status": "done"}, {"code": "S = str(input())\n\nN = len(S)\nX = []\nfor i in range(N-2):\n  tmp = 100*int(S[i]) + 10*int(S[i+1]) + int(S[i+2])\n  X.append(abs(753 - tmp))\nprint(min(X))", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "S = str(input())\nNumbers = list(S)\nLength = len(Numbers)\nLunlun_choce = []\n\nfor i in range(Length - 2):\n    choice = Numbers[0:3]\n    # print(choice)\n    X = \"\".join(choice)\n    number = int(X)\n    ans = abs(753 - number)\n    Lunlun_choce.append(ans)\n    Numbers.pop(0)\n\nprint(min(Lunlun_choce))", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "S=input()\nans=0\nfor i in range(len(S)-2):\n    tmp=int(S[i:i+3])\n    if abs(753-tmp)<abs(753-ans):\n        ans=tmp\n\nprint(abs(753-ans))", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "S = input()\n\nmin_num = 753\nfor i in range(len(S)-2):\n  diff = abs(753 - int(S[i:i+3]))\n  min_num = diff if diff < min_num else min_num\n\nprint(min_num)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "S = input()\n\nlists = []\nS_len = len(S)\n\nfor i in range(0, S_len - 2):\n    X = int(S[i] + S[i + 1] + S[i + 2])\n    lists.append(abs(X - 753))\n\nprint(min(lists))", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "S = input()\na = 999\nfor i in range(len(S)-2):\n  X = int(S[i]+S[i+1]+S[i+2])\n  if a > abs(X -753):\n    a = abs(X -753)\nprint(a)", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "S=input()\n\nl=[]\nfor i in range(len(S)):\n\tl.append((abs(753-int(S[i:i+3]))))\n\nprint(min(l))", "passed": true, "time": 0.27, "memory": 14340.0, "status": "done"}, {"code": "s = input()\nans = 999\nfor i in range(0, len(s) - 2):\n    if ans > abs(int(s[i:i + 3]) - 753):\n        ans = abs(int(s[i:i + 3]) - 753)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "S=input()\nm=1000\nfor i in range(0,len(S)-2):\n    m=min(m,abs(753-int(S[i:i+3])))\nprint(m)\n", "passed": true, "time": 0.16, "memory": 14304.0, "status": "done"}, {"code": "s = input()\nans = 753\nfor i in range(len(s)-2):\n  x = abs(753 - int(s[i:i+3]))\n  ans = min(ans, x)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n = input()\ncount = 1000\nfor i in range(len(n)-2):\n    count = min(count, abs(753 - int(n[i:i+3])))\nprint(count)", "passed": true, "time": 0.54, "memory": 14108.0, "status": "done"}, {"code": "S=input()\nans=1000\nfor i in range(len(S)-2):\n  s=int(S[i:i+3])\n  ans=min(ans,abs(753-s))\nprint(ans)", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "s = input()\nans = abs(753 - int(s[0] + s[1] + s[2]))\nfor i in range(1,len(s) - 2):\n    n = s[i]+ s[i + 1] + s[i + 2]\n    ans = min(ans,abs(int(n) - 753))\nprint(ans)", "passed": true, "time": 0.21, "memory": 14132.0, "status": "done"}, {"code": "s = input()\nres = 1000\nfor i in range(len(s) - 2):\n    res = min(res, abs(753 - int(s[i : i + 3])))\nprint(res)", "passed": true, "time": 0.23, "memory": 14276.0, "status": "done"}, {"code": "import sys\n\ns = str(input())\nv = 753\ndist = sys.maxsize\n\nfor i in range(0,len(s)-2,1):\n    if  dist > abs(int(s[i:i+3])-v):\n        dist = abs(int(s[i:i+3])-v)\nprint(dist)", "passed": true, "time": 0.23, "memory": 14304.0, "status": "done"}, {"code": "s=input()\nans = 653\nfor i in range(len(s)-2):\n    x = abs(753 - int(s[i:i+3]))\n    ans = min(ans,x)\nprint(ans)", "passed": true, "time": 0.18, "memory": 14072.0, "status": "done"}, {"code": "S = input()\nS += '0'\n\nnum_len = 999\nfor i in range(len(S)-3):\n    X = int(S[i:i+3])\n    num_len = min(num_len, abs(753-X))\n\nprint(num_len)", "passed": true, "time": 0.2, "memory": 14144.0, "status": "done"}, {"code": "# import numpy as np\n# import math\n\n# from scipy.special import perm : perm(n, r, exact=True)\n# from scipy.special import comb : comb(n, r, exact=True)\n\n# import itertools\n# for v in itertools.combinations(L, n):M.append(list(v))\n\n# from numba import njit\n# @njit('f8(i8,i8,i8,i8,f8[:,:,:])', cache=True)\n\n\n\"\"\" Definitions  \"\"\"\n\ndef lcm(a, b):\n    return a*b//math.gcd(a, b)\n\nMOD = 10**9+7\n\n# ============================================================\ns = input()\nL = []\n\nfor i in range(len(s)):\n    L.append(abs(int(s[i:i+3])-753))\nprint((min(L)))\n        \n", "passed": true, "time": 0.21, "memory": 14188.0, "status": "done"}, {"code": "s = input()\n\n\ndef answer(s: str) -> int:\n    answer = abs(753 - int(s[0] + s[1] + s[2]))\n    for i in range(1, len(s) - 2):\n        n = s[i] + s[i + 1] + s[i + 2]\n        answer = min(answer, abs(int(n) - 753))\n    return answer\n\n\nprint(answer(s))", "passed": true, "time": 0.15, "memory": 14324.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef ngram(data,n):\n    return [data[i:i+n] for i in range(len(data))]\n\ndef main():\n    s = input().rstrip()\n    datas=ngram(s,3)\n    answers=[]\n    \n    for data in datas:\n        answers.append(abs(753-int(data)))\n    print(min(answers))\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "a = input()\nans = 10000\nfor i in range(len(a)-2):\n  ans = min(abs(753-int(a[i:i+3])),ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "S = input()\nN = 1000\n\nfor i in range(len(S) - 2):\n    N = min(N, abs(753 - int(S[i : i + 3])))\nprint(N)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "s = list(input())\ns_len = len(s)\ns_list = []\nfor i in range(0, s_len - 2):\n    s_list.append(abs(753 - int((s[i] + s[i + 1] + s[i + 2]))))\n\nprint((min(s_list)))\n", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "s = input()\nres = 1000\nfor i in range(len(s) - 2):\n    res = min(res, abs(753 - int(s[i : i + 3])))\nprint(res)\n", "passed": true, "time": 0.18, "memory": 14328.0, "status": "done"}, {"code": "s = input()\nl = [int(s[i:i+3]) for i in range(len(s)-2)]\nans = 753\nfor i in range(len(l)):\n  ans = min(ans,abs(l[i]-753))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "# B - 754\n# https://atcoder.jp/contests/abc114/tasks/abc114_b\n\ns = input()\n\nresult = 753\n\nfor i in range(len(s) - 2):\n    wk = abs(753 - int(s[i:i + 3]))\n    if result > wk:\n        result = wk\n\nprint(result)\n", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "ma = lambda :map(int,input().split())\nlma = lambda :list(map(int,input().split()))\ntma = lambda :tuple(map(int,input().split()))\nni = lambda:int(input())\nyn = lambda fl:print(\"YES\") if fl else print(\"NO\")\nimport collections\nimport math\nimport itertools\nimport heapq as hq\nimport sys\n\ns = input()\ntmp=10**11\nfor i in range(0,len(s)-2):\n    tmp = min(tmp,abs(753-int(s[i:i+3])))\nprint(tmp)\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "s=input()\n\nnum=len(s)\nans_list=[]\nfor i in range(num-2):\n    x=int(s[i:i+3])\n    ans_list.append(abs(x-753))\n    \nprint((min(ans_list)))\n", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "s=list(input())\nt=[int(a) for a in s]\nn=int(len(t))\nans=0\nb=0\nlist1=[]\ns=1000\nfor i in range(n-2):\n    u=[t[i],t[i+1],t[i+2]]\n    v=\"\".join(map(str, u))\n    w=int(v)-753\n    list1.append(w)\nu=int(len(list1))\nfor i in range(u):\n    if abs(list1[i])-abs(s)<=0:\n        s=list1[i]\n    else :\n        pass\nprint((abs(s)))\n", "passed": true, "time": 0.15, "memory": 14124.0, "status": "done"}, {"code": "s = input()\n\ny = []\nfor i in range(1 , len(s) - 1):\n    x = int(s[i - 1 : i + 2])\n    y.append(abs(x - 753))\nprint(min(y))", "passed": true, "time": 0.15, "memory": 14252.0, "status": "done"}, {"code": "S=input()\na=1145141919810\nfor i in range(len(S)-2):\n  a=min(a,abs(753-int(S[i:i+3])))\nprint(a)", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "S = input()\nT = [0]*len(S)\nA = [0]*(len(S)-2)\n\nfor i in range(len(S)):\n    T[i] = int(S[i])\n\nfor j in range(len(S)-2):\n    A[j] = 100*T[j]+10*T[j+1]+T[j+2]\n    A[j] = abs(A[j]-753)\n\nprint((min(A)))\n", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "A = list(input())\nans = list()\nfor i in range(len(A)-2):\n  num = int(A[i])*100+int(A[i+1])*10+int(A[i+2])\n  ans.append(abs(num-753))\nprint(min(ans))", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "n = input()\nl = len(n)\nn = int(n)\n\nres = 1000\nfor i in range(l-2):\n  c = n // (10 ** i)\n  c %= 1000\n  res = min(res,abs(c-753))\n  #print(i,c)\nprint(res)", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "s = input()\n\nm = -1\nfor x in zip(s[0:], s[1:], s[2:]):\n\tnumber = abs(753 - int(\"\".join(x)))\n\tif m < 0:\n\t\tm = number\n\telif number < m:\n\t\tm = number\n\t\t\nprint(m)", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "S = input()\nans = []\nfor i in range(len(S)-2):\n    temp = int(S[i:i+3])\n    ans.append(abs(753-temp))\nprint((min(ans)))\n", "passed": true, "time": 0.15, "memory": 14252.0, "status": "done"}, {"code": "# -*- coding:utf-8 -*-\nS = input()\n\nans_list = []\nans = 753\ntemp = 0\n\nfor s in S:\n    ans_list.append(s)\n\nfor i in range(len(ans_list)-2):\n    temp = int(ans_list[i])*100+int(ans_list[i+1])*10+int(ans_list[i+2])\n    comp = abs(temp - 753)\n    if ans > comp:\n        ans = comp\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "S=input()\nans=753753753753753753753753753753\nfor i in range(len(S)-2):\n    temp=int(S[i:i+3])\n    if abs(temp-753)<ans:\n        ans=abs(temp-753)\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14396.0, "status": "done"}, {"code": "# \u6587\u5b57\u5217\u306e\u53d6\u5f97\ns = str(input())\nslen = len(s)\n\n# \u6700\u5c0f\u5024\u3092\u53d6\u5f97\u3057\u51fa\u529b\ncmin = 998\nfor cnt in range(0,slen-2,1):\n    cmin = min(cmin,(abs(753 - int(s[cnt:cnt+3]))))\n\nprint(cmin)", "passed": true, "time": 0.23, "memory": 14336.0, "status": "done"}, {"code": "\n\ns = input()\n\ny = []\nfor i in range(1 , len(s) - 1):\n    x = int(s[i - 1 : i + 2])\n    y.append(abs(x - 753))\nprint(min(y))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "S = input()\nx = abs(753 - int(S[0] + S[1] + S[2]))\n\nfor i in range(1, len(S) - 2):\n    n = S[i] + S[i + 1] + S[i + 2]\n    x = min(x,abs(753 - int(n)))\n\nprint(x)\n", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "s=input()\nd=1000\nfor i in range(len(s)-1):\n  if abs(int(s[i:i+3])-753)<d:\n    d=abs(int(s[i:i+3])-753)\nprint(d)", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "S = input()\n\nnum_len = 999\nfor i in range(len(S)-2):\n    X = int(S[i:i+3])\n    num_len = min(num_len, abs(753-X))\n\nprint(num_len)", "passed": true, "time": 0.23, "memory": 14200.0, "status": "done"}, {"code": "S = input()\nans = 999\nfor i in range(len(S)-2):\n    s = S[i]+S[i+1]+S[i+2]\n    ans = min(ans, abs(753-int(s)))\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "s = list(map(str, input()))\nt = len(s)\n\ni = 0\nl = []\nfor _ in range(t - 3):\n    for _ in s:\n        if i <= t - 3:\n            x = (s[i]+s[i + 1]+s[i + 2])\n            l.append(x)\n        i += 1\ntmp = []\nfor num in l:\n    y = abs(int(num) - 753)\n    tmp.append(y)\nprint((min(tmp)))\n", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "S = str(input())\n\nN = len(S)\nX = []\nfor i in range(N-2):\n  X.append(abs(753 - int(S[i:i+3])))\nprint(min(X))", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "S = input()\n\nresult = 10 ** 9\nfor i in range(len(S) - 3 + 1):\n  result = min(result, abs(753 - int(S[i:i+3])))\n  \nprint(result)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "s = input()\n\ndef answer(s: str) -> int:\n    answer = abs(753 - int(s[0] + s[1] + s[2]))\n    for i in range(1, len(s) - 2):\n        n = s[i] + s[i + 1] + s[i + 2]\n        answer = min(answer, abs(int(n) - 753))\n    return answer\n\nprint((answer(s)))\n\n", "passed": true, "time": 0.15, "memory": 14120.0, "status": "done"}, {"code": "s = input()\na = 753\nfor i in range(len(s)-2):\n    b = int(s[i])*100 + int(s[i+1])*10 + int(s[i+2])\n    c = abs(753 - b)\n    if a > c:\n        a = c\n        a = abs(a)\nprint(a)\n", "passed": true, "time": 0.15, "memory": 14088.0, "status": "done"}, {"code": "string = input()\ndifference = []\nfor i in range(0, len(string) - 2):\n    difference.append(abs(int(string[i:i + 3]) - 753))\nprint((min(difference)))\n", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "s = str(input())\nans = 753\nfor i in range(len(s)-2):\n  ch = int(s[i]+s[i+1]+s[i+2])\n  if abs(ch-753) <= ans:\n    ans = abs(ch-753)\nprint(ans)  ", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "s=[int(i) for i in input()]\nans=1000\nfor i in range(2,len(s)):\n  tmp=s[i-2]*100+s[i-1]*10+s[i]\n  ans=min(ans,abs(753-tmp))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "import math\ns=list(input())\na=[]\nfor i in range(len(s)-2):\n  p=100*int(s[i])+10*int(s[i+1])+int(s[i+2])\n  a.append(abs(p-753))\nprint(min(a))", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "S = str(input())\nsaishou = 1000\n\nfor i in range(len(S)-2):\n    SS = int(S[i]+S[i+1]+S[i+2])\n    if abs(753-SS) < saishou:\n        saishou = abs(753-SS)\n\nprint(saishou)", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "s=list(map(str,input()))\n\nlst=[]\nfor i in range(len(s)-2):\n\ttotal=s[i]+s[i+1]+s[i+2]\n\tans=abs(753-int(total))\n\tlst.append(ans)\n\t\n\nprint(min(lst))", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "S = input()\nans = []\nfor i in range(len(S)-2):\n    chk = int(S[i]+S[i+1]+S[i+2])\n    if chk == 753:\n        print((0))\n        return\n    else:\n        ans.append(abs(753-chk))\nans = sorted(ans)\nprint((ans[0]))\npass\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "S = input()\nprint((min(abs(int(S[i:i + 3]) - 753) for i in range(len(S) - 2))))\n", "passed": true, "time": 0.2, "memory": 14136.0, "status": "done"}, {"code": "def vax(S, num):\n    nums = [999]\n    index = [ i for i, x in enumerate(S) if x == str(num) and i <= len(S) - 3]\n    for i in index:\n        nums.append(abs(753 - int( S[i] + S[i+1] + S[i+2])))\n    return min(nums)\n\nS = list(input())\nans = 999\nfor i in range(10):\n    ans = min(vax(S, i), ans)\nprint(ans)", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "S = input()\n\ns = []\nfor i in S:\n    s.append(i)\n\nss = []\ni = 0\nwhile i < len(s) - 2:\n    ss.append(\"\".join(s[i:i+3]))\n    i += 1\n\nabso = []\nfor n in ss:\n    abso.append(abs(753 - int(n)))\n\nprint(min(abso))", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "table = list(map(int, input()))\ndiff_nagomi = 1000\nans = 0\nfor i in range(len(table)-2):\n    diff = abs(table[i] * 100 + table[i + 1] * 10 + table[i + 2] - 753)\n    if diff_nagomi > diff:\n        ans = diff\n        diff_nagomi = diff\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "S = input()\nN = len(S)\nans = 1000\n\nfor i in range(N-2):\n    ans = min(ans, abs(753-(int(S[i])*100+int(S[i+1])*10+int(S[i+2]))))\n\nprint(ans)", "passed": true, "time": 0.19, "memory": 14088.0, "status": "done"}, {"code": "s = input()\n\nl = len(s)\nT = 753\n\nans = float('INF')\nfor i in range(l-2):\n    num_str = s[i]+s[i+1]+s[i+2]\n    num = int(num_str)\n    ans = min(ans,abs(T-num))\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "s = input()\nans = []\n\nfor i in range(len(s)-2):\n    number = int(s[i] + s[i+1] + s[i+2])\n    ans.append(abs(number - 753))\n\nprint(min(ans))", "passed": true, "time": 0.14, "memory": 14416.0, "status": "done"}, {"code": "s = input()\n\nans = 1000\nfor i in range(len(s) - 2):\n    ans = min(ans, abs(int(s[i:i + 3]) - 753))\nprint(ans)   ", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "S = list(input())\nP = X = 753\n\nfor num in range(len(S) -2):\n    a = int(S[num] + S[num+1] + S[num+2])\n    a = abs(P - a)\n    if a <= X:\n        X = a\n\nprint(X)", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "S = str(input())\n\nabs_list = []\n\nfor i in range(1, len(S)-1):\n    # print(S[i-1:i+2])\n    X = int(S[i-1:i+2])\n    abs_list.append(abs(X - 753))\n    abs_min = min(abs_list)\n\nprint(abs_min)", "passed": true, "time": 0.24, "memory": 14312.0, "status": "done"}, {"code": "S = input()\n\ns = [i for i in S]\nss = []\n\ni = 0\nwhile i < len(s) - 2:\n    ss.append(abs(753 - int(\"\".join(s[i:i+3]))))\n    i += 1\n\nprint(min(ss))", "passed": true, "time": 0.24, "memory": 14256.0, "status": "done"}, {"code": "s = input()\nl = len(s)\n\nans = 1000\nfor i in range(l - 2):\n    num = int(s[i] + s[i + 1] + s[i + 2])\n    ans = min(ans, abs(753 - num))\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "def main():\n    s = input()\n    print(min(abs(int(s[i:i+3]) - 753) for i in range(len(s)-3+1)))\n\n\nmain()", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "# B - 754\n\n# 1\uff5e9\u304b\u3089\u306a\u308b\u6587\u5b57\u5217S\u304b\u3089\u9023\u7d9a\u3059\u308b3\u6587\u5b57\u3092\u53d6\u308a\u51fa\u3059\n# \u53d6\u308a\u51fa\u3057\u305f\u6587\u5b57\u5217\u3068753\u3068\u306e\u5dee\u306e\u7d76\u5bfe\u5024\u306f\u6700\u5c0f\u3067\u3044\u304f\u3064\u304b\u51fa\u529b\u3059\u308b\n\nS = input()\nanswer = 999\n\nfor i in range(len(S) - 2):\n    num = int(S[i] + S[i+1] + S[i+2])\n    if answer > abs(num - 753):\n        answer = abs(num - 753)\n\nprint(answer)", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "s=input()\nans = 1000\nfor i in range(len(s) -2):\n  ans = min(abs(int(s[i:i+3])- 753), ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "s = input()\n\nfav = 753\nans = 1e6\nfor i in range(len(s)-2):\n    num = int(s[i:i+3])\n    ans = min(ans, abs(num-fav))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "s = input()\na = []\nfor i in range(len(s)-2):\n    a.append(int(s[i]+s[i+1]+s[i+2]))\nfor i in range(len(a)):\n    a[i] = abs(a[i]-753)\nprint((min(a)))\n", "passed": true, "time": 0.14, "memory": 14372.0, "status": "done"}, {"code": "s=list(input())\nm=642\nfor i in range(len(s)-2):\n    if abs(100*int(s[i])+10*int(s[i+1])+int(s[i+2])-753) < m:\n        m=abs(100*int(s[i])+10*int(s[i+1])+int(s[i+2])-753)\n\nprint(m)\n        \n", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "N=int(input())\ndef ans114(N:int):\n    answer = 0\n    N=str(N)\n    while len(N)>=3:\n        N2=int(N[0]+N[1]+N[2])\n        if abs(753-N2)<abs(answer-753):\n            answer=N2\n            N=N[1:]\n        else:\n            N=N[1:]\n    return abs(753-answer)\nprint(ans114(N))", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "s = input()\nans = 753\nfor i in range(len(s) - 2):\n  x = int(s[i:i+3])\n  if abs(753 - x) < ans:\n    ans = abs(753-x)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "s = list(input())\n\nmylist = []\nfor i in range(len(s) - 2):\n    number = abs(753 - int(s[i] + s[i + 1] + s[i + 2]))\n    mylist.append(number)\n\nprint(min(mylist))", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "# author:  Taichicchi\n# created: 10.10.2020 23:35:00\n\nimport sys\n\nS = input()\n\nm = 10000000\n\nfor i in range(3, len(S) + 1):\n    m = min(m, abs(753 - int(S[i - 3:i])))\n\nprint(m)\n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "s = input()\n\nans = 1000\nfor i in range(len(s) - 2):\n    diff = abs(int(s[i:i+3]) - 753)\n    if diff < ans:\n        ans = diff\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}]