#!/bin/bash

read line
length=`echo ${#line}`

num=`expr $length - 2`

min=999

for i in `seq 1 $num`
do
 a=`echo $line | cut -b $i`
 b=`echo $line | cut -b $((i+1))`
 c=`echo $line | cut -b $((i+2))`
 d=`expr 753 - $a$b$c`
 diff=`echo sqrt"($d^2)" | bc`
 if [ $diff -le $min ] ; then
  min=$diff
 fi
done


echo $min