#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
using namespace std;
inline long long in() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long f1[10000], f2[10000];
int32_t main() {
  long long n = in();
  long long a = in();
  long long b = in();
  long long x = in();
  long long y = in();
  f1[0] = a;
  f2[0] = x;
  for (long long i = 1; i < 10000; i++) {
    f1[i] = (f1[i - 1] + 1) % (n + 1);
    if (f1[i] == 0) f1[i] = 1;
    f2[i] = (f2[i - 1] + n) % (n + 1);
    if (f2[i] == 0) f2[i] = n;
    if (f1[i] == f2[i]) {
      puts("YES");
      return 0;
    }
    if (f1[i] == b) break;
    if (f2[i] == y) break;
  }
  puts("NO");
}
