Given is a string S consisting of digits from `1` through `9`.

Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:

Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Constraints

* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.

Input

Input is given from Standard Input in the following format:


S


Output

Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.

Examples

Input

1817181712114


Output

3


Input

14282668646


Output

2


Input

2119


Output

0
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 2019;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        // 3 673
        int[] k = new int[s.length()];
        for (int i = 0; i < s.length(); i++)
            k[i] = (int) s.charAt(i) - '0';
        int tmp = 0;
        int pom = 1;
        int[] mem = new int[s.length()];
        int[] map = new int[MOD];
        tmp = 0;
        map[0]++;
        for (int i = 0; i < s.length(); i++) {
            tmp += k[s.length() - i - 1] * pom;
            tmp %= MOD;
            pom *= 10;
            pom %= MOD;
            mem[i] = tmp;
            map[tmp]++;
        }
        long ans = 0;
        for(int i=0;i<2019;i++){
            ans += map[i]*(map[i]-1)/2;
        }
        System.out.println(ans);
        System.err.println(Arrays.toString(mem));
    }

    public static void main(String[] args) {
        new Main();
    }
}
