#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    int n, a, b;
    cin >> n >> a >> b;
    --a;
    a += b;
    a %= n;
    a += n;
    a %= n;
    cout << a + 1 << endl;
  }
}
