#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int base = INF;
int main() {
  ios_base::sync_with_stdio(0);
  int n, a, b;
  cin >> n >> a >> b;
  if (b >= 0) {
    int x = (a + b) % n;
    if (x == 0)
      cout << n << endl;
    else
      cout << x << endl;
    return 0;
  }
  int cur = a;
  b = abs(b);
  while (b >= cur) {
    b -= cur;
    cur = n;
  }
  cout << cur - b << endl;
  return 0;
}
