#include <bits/stdc++.h>
using namespace std;
int h, m, s, x, y, num1 = 0;
double nowh, nowm, nows, nowx, nowy, l, r;
int main() {
  cin >> h >> m >> s >> x >> y;
  nows = s * 1.0 * 6;
  nowm = m * 1.0 * 6 + nows / 360 * 6;
  nowh = h * 30 + nowm / 360 * 30;
  nowx = x * 30;
  nowy = y * 30;
  l = min(nowx, nowy);
  r = max(nowx, nowy);
  if (nows >= l && nows <= r) num1++;
  if (nowm >= l && nowm <= r) num1++;
  if (nowh >= l && nowh <= r) num1++;
  if (num1 == 0 || num1 == 3)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
