#include <bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	cin >> s;

	long long int ans=0;

	for (int i=0; i<s.size()-4; i++)
	{
		for (int j=i+4; j<s.size();j++)
		{
			long long int num;
			istringstream ss = istringstream( s.substr(i,j-i+1));
			ss >> num;
			// cout << num << endl;
			if (num % 2019 == 0)
			{
				ans++;
				cout << i+1 << " " <<  j+1 << endl;
			}
		}
	}

	cout << ans << endl;
}