#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;


int k,s,t;
int seq[22];
bool v[22][99907];
typedef pair<int,int> pr;

int normalize(int i){
  i %= 99907;
  if (i < 0){
    i += 99907;
  }
  return i;
}


void check_and_insert(int step, int val, queue<pr> & q){
  val = normalize(val);
  if (!v[step % k][val]){
    v[step % k][val] = true;
    q.push( pr(val, step) );
  }
}

int main(){

  while (cin >> s >> t >> k){
    for (int i = 0; i < k; ++i){
      cin >> seq[i];
    }

    memset(v, 0, sizeof(v));
    v[0][s] = true;

    queue<pr> q;
    q.push( pr(s,0) );
    int sol = -1;

    while (!q.empty()){
      pr cur = q.front();
      q.pop();

      //cout << cur.first << ' '  << cur.second << endl; 
      if (cur.first == t){
        sol = cur.second;
        break;
      }

      //cout << " + " << normalize(cur.first + seq[cur.second % k]) << ' ' << cur.second + 1 << endl;
      check_and_insert( cur.second+1, cur.first + seq[cur.second % k], q);
      //cout << " - " << normalize(cur.first - seq[cur.second % k]) << ' ' << cur.second + 1 << endl;
      check_and_insert( cur.second+1, cur.first - seq[cur.second % k], q);
      //cout << " * " << normalize(cur.first * seq[cur.second % k]) << ' ' << cur.second + 1 << endl;
      check_and_insert( cur.second+1, cur.first * seq[cur.second % k], q);
      //cout << " / " << normalize(cur.first / seq[cur.second % k]) << ' ' << cur.second + 1 << endl;
      if (seq[cur.second % k] != 0)
        check_and_insert( cur.second+1, cur.first / seq[cur.second % k], q);
    }

    if (sol == -1){
      cout << "cannot reach" << endl;
    } else {
      cout << sol << endl;
    }

  }

  

}
