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