#include <bits/stdc++.h>
using namespace std;
long long ra[1000004];
long long rb[1000003];
int main() {
  string s;
  cin >> s;
  long long int a, b;
  cin >> a >> b;
  int g = s[0] - '0';
  ra[0] = g % a;
  for (long i = 1; i < s.size(); i++) {
    g = s[i] - '0';
    ra[i] = (10 * ra[i - 1] + g);
    ra[i] = ra[i] % a;
  }
  g = s[s.size() - 1] - '0';
  rb[s.size() - 1] = g % b;
  long long int h = 10;
  for (long i = s.size() - 2; i >= 0; i--) {
    g = s[i] - '0';
    long long int k = h * g;
    k = k % b;
    rb[i] = (k + rb[i + 1]) % b;
    h = h * 10;
    h = h % b;
  }
  long l, o = 0;
  for (long i = 0; i < s.size() - 1 && o == 0; i++) {
    if (ra[i] == 0 && rb[i + 1] == 0 && s[i + 1] != '0') {
      o = 1;
      l = i;
    }
  }
  if (o == 0)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    for (long i = 0; i < s.size(); i++) {
      if (i == l)
        cout << s[i] << endl;
      else
        cout << s[i];
    }
    cout << endl;
  }
}
