#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} s[1111];
int chaji(node a, node b) { return a.y * b.x - a.x * b.y; }
int main() {
  int n;
  cin >> n;
  int a, b;
  cin >> a >> b;
  if ((a + b) % n == 0)
    cout << n << endl;
  else
    cout << ((a + b) % n + n) % n << endl;
}
