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