#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e, f;
  char ch, ch2;
  c = scanf("%d%d", &a, &b);
  d = scanf("%d%c%d%c", &e, &ch, &f, &ch2);
  int count1, count2;
  while (e > 0) {
    e = e / 10;
    count1 += 1;
  }
  while (f > 0) {
    f = f / 10;
    count2 += 1;
  }
  if (d != 3) {
    printf("No");
  } else {
    if (a == count1 && b == count2) {
      printf("Yes");
    } else {
      printf("No");
    }
  }
  return 0;
}
