#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
using namespace std;
int main() {
  int n, a, b;
  read(n);
  read(a);
  read(b);
  cout << ((a + b) % n + n - 1) % n + 1 << endl;
  return 0;
}
