#include <bits/stdc++.h>
using namespace std;
long long int const mod = 1e9 + 7;
long long int const inf = 1e18;
long long int const mxn = 2e9 + 1;
inline void file() {}
int main() {
  file();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  {
    long long int n, a, b;
    cin >> n >> a >> b;
    if (b < 0) {
      b = abs(b) % n;
      if (a > b)
        cout << a - b;
      else
        cout << a - b + n;
    } else {
      a += b;
      if (a % n == 0)
        cout << n << "\n";
      else
        cout << a % n << "\n";
    }
  }
}
