#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int t, i, j;
  int n, a, b;
  cin >> n >> a >> b;
  int ans = (a + b) % n;
  if (ans == 0) ans = n;
  if (ans < 0) ans += n;
  cout << ans;
}
