Racket 134 bytes
-

    (let((s(number->string n))(h string->number)(g substring))(for/sum((i(range 1(string-length s))))(modulo n(+(h(g s 0 i))(h(g s i))))))
    
Ungolfed: 

    (define (f n)
      (let ((s (number->string n))
            (h string->number)
            (g substring))
        (for/sum ((i (range 1 (string-length s))))
          (modulo n (+ (h (g s 0 i)) (h (g s i)))))))

Testing: 
    
    (f 47852)
    (f 13)
    (f 111)
    (f 12345)
    (f 54321)
    (f 3729105472)

Output: 
    
    5842
    1
    6
    2097
    8331
    505598476