#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
const int inf = (int)1e9;
const long double eps = 1e-9;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  a += n * 1000;
  a += b;
  a %= n;
  if (a == 0) {
    a = n;
  }
  cout << a;
  return 0;
}
