#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, m, s, t1, t2, x, mm, ss;
  cin >> h >> m >> s >> t1 >> t2;
  bool h1, h2, m1, m2, s1, s2;
  h1 = h2 = m1 = m2 = s1 = s2 = false;
  mm = m;
  ss = s;
  while (1) {
    if (s == 0) s = 60;
    if (s == 61) s = 1;
    if (s % 5 == 0 && s / 5 == t1) {
      s1 = true;
      break;
    }
    if (s % 5 == 0 && s / 5 == t2) {
      s2 = true;
      break;
    }
    s++;
  }
  while (1) {
    if (ss > 0) m++;
    if (m == 0) m = 60;
    if (m == 61) m = 1;
    if (m % 5 == 0 && m / 5 == t1) {
      m1 = true;
      break;
    }
    if (m % 5 == 0 && m / 5 == t2) {
      m2 = true;
      break;
    }
    if (ss == 0) m++;
  }
  while (1) {
    if ((ss > 0 && mm == 0) || mm > 0) h++;
    if (h == 13) h = 1;
    if (h == t1) {
      h1 = true;
      break;
    }
    if (h == t2) {
      h2 = true;
      break;
    }
    if (ss == 0 && mm == 0) h++;
  }
  cout << (((h1 & m1 & s1) || (h2 & m2 & s2)) ? "YES" : "NO");
}
