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