#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long a, int p, long long int m) {
  if (p == 0) return 1;
  if (p & 1) {
    return ((a % m) * (bigmod(a, p - 1, m))) % m;
  } else {
    long long tmp = bigmod(a, p / 2, m);
    return (tmp * tmp) % m;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long int a;
  cin >> a;
  long long int b;
  cin >> b;
  long long int n = s.size();
  long long int t = 0;
  long long int dp[n];
  for (long long int i = 0; i < n; i++) {
    t = ((t * 10) + (s[i] - '0')) % a;
    dp[i] = t;
  }
  long long int dp1[n];
  t = 0;
  long long int l = 1;
  for (long long int i = n - 1; i >= 0; i--) {
    t = (((s[i] - '0')) * (l) + t) % b;
    dp1[i] = t;
    l = (l * 10) % b;
  }
  long long int i;
  for (i = 0; i < n - 1; i++) {
    if (dp[i] == 0 && dp1[i + 1] == 0 && s[i + 1] != '0') {
      cout << "YES"
           << "\n";
      break;
    }
  }
  if (i == n - 1)
    cout << "NO";
  else {
    for (long long int j = 0; j < n; j++) {
      cout << s[j];
      if (j == i) cout << "\n";
    }
  }
  return 0;
}
