#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int main() {
  cin >> n >> a >> b;
  for (; b < 0 || b > n;) {
    if (b < 0)
      b += n;
    else
      b -= n;
  }
  a += b;
  if (a > n) a -= n;
  cout << a;
  return 0;
}
