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