#include <bits/stdc++.h>
using namespace std;
long long cl(long long n, long long m) {
  if (n % m)
    return n / m + 1;
  else
    return n / m;
}
long long pw(long long a, long long b) {
  long long r = 1;
  while (b > 0) {
    if (b & 1) r = r * a;
    a = a * a;
    b >>= 1;
  }
  return r;
}
const long long N = 1e6 + 5;
long double x1, x2;
bool in(long double A, long double B) {
  if (x1 >= A && x1 <= B && x2 >= A && x2 <= B)
    return true;
  else
    return false;
}
signed main() {
  vector<long double> v;
  long double h, m, s, t1, t2;
  cin >> h >> m >> s >> t1 >> t2;
  h = (long long)h % 12;
  long double hr = (3600 * h + 60 * m + s) / 120.0;
  long double min = (60 * m + s) / 10.0;
  long double sec = s * 6;
  x1 = 30 * t1;
  x2 = 30 * t2;
  v.push_back(hr);
  v.push_back(min);
  v.push_back(sec);
  v.push_back(x1);
  v.push_back(x2);
  sort(v.begin(), v.end());
  v.push_back(v[0]);
  for (long long i = 0; i < v.size() - 1; i++) {
    if (v[i] == x1 && v[i + 1] == x2) cout << "YES", exit(0);
    if (v[i] == x2 && v[i + 1] == x1) cout << "YES", exit(0);
  }
  cout << "NO\n";
}
