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