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