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