#include <bits/stdc++.h>
using namespace std;
long long expo(long long x, long long n, long long m) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return expo((x * x) % m, n / 2, m);
  else
    return (x * expo((x * x) % m, (n - 1) / 2, m)) % m;
}
vector<vector<int> > lists(100005);
int visit[100009];
int node;
int edges;
void dfs(int x) {
  edges += lists[x].size();
  node++;
  visit[x] = 1;
  for (int i = 0; i < lists[x].size(); i++) {
    if (visit[lists[x][i]] == 0) {
      visit[lists[x][i]] = 1;
      dfs(lists[x][i]);
    }
  }
}
void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  a--;
  a = (a + b + 10000 * n) % n;
  a++;
  cout << a << endl;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
