#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a;
  int b;
  cin >> n;
  cin >> a;
  cin >> b;
  int final = a + b;
  if (final > n) {
    int f = final % n;
    f = f == 0 ? n : f;
    cout << f << endl;
  } else if (final < 1) {
    cout << n - abs(final % n) << endl;
  } else {
    cout << final << endl;
  }
  return 0;
}
