#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long int i, j, a, b, n, ans;
  cin >> n >> a >> b;
  ans = (a + b + n) % n;
  if (ans == 0) {
    cout << n;
    return 0;
  }
  if (ans < 0) {
    cout << ans + n;
    return 0;
  }
  cout << ans;
  return 0;
}
