program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) s
    n=len_trim(s)
    m=10000
    do i=1,n-2
        read(s(i:i+2),*)a
        b=abs(a-753)
        if(b<m)then
            m=b
        end if
    end do
    write(*,*)m
   
    stop
end program sample
  

