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