#include <bits/stdc++.h>
using namespace std;
long long n, p, l, k = 1, i, r, x, b, m, f, c = 0, d, h, y, w, e, t, a,
                   j[100005], g[100005];
string q, s;
char v;
int main() {
  cin >> n >> a >> b;
  if (a + b > n) {
    c = a + b;
    while (c > n) {
      c -= n;
    };
    cout << c;
    return 0;
  }
  if (a + b <= 0) {
    c = a + b;
    while (c <= 0) {
      c += n;
    };
    cout << c;
    return 0;
  }
  if (b == 0) {
    cout << a;
    return 0;
  }
  cout << a + b;
}
