program multi
  implicit none

  integer :: i, j, k
  integer :: count, judge, calculate
  real(kind=8) :: number_int
  character(len=200000) :: number

  read (*,*) number

  count = len(trim(number))

  k = 0
  do i = 1, count
    do j = i+1, count
      read(number(i:j), *) number_int
      calculate = int(number_int)
      judge = mod(calculate,2019)
      if(judge == 0) then
        k = k + 1
      else

      end if
    end do
  end do

print *, k
end program multi

