#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int main ()
{
    long long int x,i=0,j,y,br=0,lol=1,omg,g=1,p;
    double n,d,m,a,b;
    cin>>a>>b>>n>>d;
    m=n/d;
    for(x=a; x<=b; x++)
        {
          y=(x*d)/n;
          if(y!=round((x*d)/n)) p=1;
          else {
                for(x=a; x<=b; x++)
                    {
                        omg=y;
                            do
                                {
                                    omg/=10;
                                    i++;
                                }
                            while(omg);
                for(j=0; j<i; j++)
                    {
                        for(j=0; j<i; j++)
                            {
                                g*=10;
                            }
                        lol=lol*g*y%10;
                        cout<<y<<" "<<g<<" ";
                        g/=10;
                        y/=10;
                    }
                        if(x/y==n/d&&x==lol) br++;
                    }
          }
        }
    
    cout<<br<<endl;
    return 0;
}