#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const double eps = 1e-4;
const int mod = 1e9 + 7;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 7;
const int maxm = 1e6 + 7;
const double pi = acos(-1.0);
int vis[30];
int main() {
  int h, m, s, t1, t2;
  while (cin >> h >> m >> s >> t1 >> t2) {
    memset(vis, 0, sizeof vis);
    int t = 0;
    if (s % 5) t = 1;
    s = 2 * (s / 5) + t;
    if (m % 5 || s != 0)
      t = 1;
    else
      t = 0;
    m = 2 * (m / 5) + t;
    if (s == 0 && m == 0)
      t = 0;
    else
      t = 1;
    h %= 12;
    h = h * 2 + t;
    vis[h] = vis[m] = vis[s] = 1;
    bool flag = true;
    for (int i = 2 * min(t1, t2); i <= 2 * max(t1, t2); i++) {
      if (vis[i]) flag = false;
    }
    if (flag) {
      cout << "YES" << endl;
      continue;
    }
    flag = true;
    for (int i = 2 * max(t1, t2); i <= 2 * min(t1, t2) + 24; i++) {
      if (vis[i % 24]) flag = false;
    }
    if (flag) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
