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