#include <bits/stdc++.h>
using namespace std;
bool s[475];
inline void calc(int& d, int& p) {
  int i = d;
  for (int t = 0; t < 25; t++) {
    i = (i * 96 + 42) % 475;
    if (i + 26 == p) {
      s[d] = true;
      return;
    }
  }
}
class Compare {
 public:
  bool operator()(pair<int, int> a, pair<int, int> b) {
    return a.second > b.second;
  }
};
bool isFound[1048576];
int main() {
  int p, x, y;
  scanf("%d%d%d", &p, &x, &y);
  for (int i = 0; i < 475; i++) {
    calc(i, p);
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >, Compare> pq;
  pq.push(make_pair(x, 0));
  int cur, cnt;
  while (!pq.empty()) {
    cur = pq.top().first;
    cnt = pq.top().second;
    pq.pop();
    if (cur < y || cur > 1048576) continue;
    if (isFound[cur]) continue;
    isFound[cur] = true;
    if (s[(cur / 50) % 475]) break;
    pq.push(make_pair(cur + 100, cnt + 1));
    pq.push(make_pair(cur - 50, cnt));
  }
  printf("%d", cnt);
  return 0;
}
