#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long K = 2;
vector<long long> v[26];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  h %= 12;
  t1 %= 12;
  t2 %= 12;
  double a1 = (h / 12.0) * 360, a2 = (t1 / 12.0) * 360, a3 = (t2 / 12.0) * 360;
  double a4 = (m / 60.0) * 360, a5 = (s / 60.0) * 360;
  a1 += (m)*0.5;
  a1 += (s / (120.00));
  a4 += (s)*0.1;
  vector<double> v;
  v.push_back(a1);
  v.push_back(a2);
  v.push_back(a3);
  v.push_back(a4);
  v.push_back(a5);
  sort(v.begin(), v.end());
  bool ch = false;
  for (long long i = 0; i < 5; i++) {
    if (i == 4) {
      if (v[i] == (double)max(a2, a3) && v[(i + 1) % 5] == (double)min(a2, a3))
        ch = true;
      break;
    }
    if (v[i % 4] == (double)min(a2, a3) &&
        v[(i + 1) % 5] == (double)max(a2, a3)) {
      ch = true;
    }
  }
  if (ch)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
