#include <bits/stdc++.h>
using namespace std;
void wldd() {
  long long n, a, b;
  cin >> n >> a >> b;
  b = b % n;
  long long sum = 0;
  if (b < 0) {
    sum = n + a + b;
  } else {
    sum = a + b;
  }
  if (sum % n == 0)
    cout << n << "\n";
  else
    cout << abs(sum % n) << "\n";
}
int32_t main() {
  wldd();
  return 0;
}
