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