/***
 * Usage: n, m, p
 *
 * n - max N
 * m - max number
 * p - probability of multiply (0..100)
 ***/

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

unsigned R()
{
  return rand() + (rand() << 15);
}

int R( int l, int r )
{
  return l + R() % (r - l + 1);
}

__int64 Time()
{
  _asm rdtsc
}

#define maxn 200000

int xn = 0, x[maxn], is[maxn];
int num[maxn];

void Inc( int i, int f )
{
  if (!is[i] || f)
    num[i]++;
}

int Get( int l, int r )
{
  int i, res = 0;
  for (i = l; i <= r; i++)
    res += num[i];
  return res;
}

int main( int argc, char *argv[] )
{
  int i, j, n = atoi(argv[2]), m = atoi(argv[3]), p = atoi(argv[4]);
  int seed = atoi(argv[1]);

  srand(seed == -1 ? Time() : seed);

  int a = 1, s = 0;
  while ((n + s) / a > 1)
  {
    x[xn] = 2 + R() % (min(m, (n + s) / a) - 1);
    a *= x[xn];
    s += x[xn] - 1;
    xn++;
  }
  
  for (i = 0; i < xn; i++)
    is[i] = ((int)(R() % 100) < p ? 1 : 0);

  fprintf(stderr, "x: ");
  for (i = 0; i < xn; i++)
    fprintf(stderr, "%d ", x[i]);
  fprintf(stderr, "\nis: ");
  for (i = 0; i < xn - 1; i++)
    fprintf(stderr, "%d ", is[i]);
  fprintf(stderr, "\n");

  memset(num, 0, sizeof(num));
  for (int ij = 1; ij < xn; ij++)
    for (i = 0; i + ij < xn; i++)
    {
      int flag = 1, sum = x[i], pr = x[i];
      for (j = i + 1; j <= i + ij; j++)
      {
        sum += x[j];
        pr *= x[j];
        flag &= is[j - 1];
      }
      j = i + ij;
      if (!flag)
        while (Get(i, j - 1) + sum <= pr)
          Inc(R(i, j - 1), 0);
      else
        while (Get(i, j - 1) + sum <= pr - 2)
          Inc(R(i, j - 1), 1);
    }

  for (i = 0; i < xn - 1; i++)
    fprintf(stderr, "%d ", num[i]);
  fprintf(stderr, "\n");

  printf("%d\n", xn + Get(0, xn - 1));
  for (i = 0; i < xn - 1; i++)
  {
    printf("%d ", x[i]);
    for (j = 0; j < num[i]; j++)
      printf("1 ");
  }
  printf("%d\n", x[xn - 1]);
  return 0;
}
