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