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