#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int precision = numeric_limits<double>::digits10;
  ;
  int n, a, b;
  cin >> n >> a >> b;
  cout << (a + b - 1 + 100 * n) % n + 1;
}
