#include <bits/stdc++.h>
using namespace std;
int p, y, x;
bool func(int val) {
  unordered_map<int, bool> mp;
  int s = (val / 50) % 475;
  for (int i = 0; i < 25; i++) {
    s = (s * 96 + 42) % 475;
    mp[s + 26] = 1;
  }
  return mp[p];
}
unordered_map<int, bool> vis;
bool is_valid(int val) {
  if (val >= y && val <= 20000) return 1;
  return 0;
}
unordered_map<int, int> pa;
int ans = 1e9;
int cmt = 1;
int dfs(int val) {
  if (func(val)) {
    ans = min(ans, pa[val]);
    return 1;
  }
  if (is_valid(val - 50) && !vis[val - 50]) {
    vis[val - 50] = 1;
    pa[val - 50] = pa[val];
    if (dfs(val - 50)) return 1;
  }
  if (is_valid(val + 100) && !vis[val + 100]) {
    cout << cmt << '\n';
    cout << val << " " << val + 100 << '\n';
    cmt++;
    vis[val + 100] = 1;
    pa[val + 100] = pa[val] + 1;
    if (dfs(val + 100)) return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> p >> x >> y;
  int last_x = x;
  while (true) {
    x -= 50;
    if (x >= y && func(x)) {
      cout << 0 << '\n';
      return 0;
    }
    if (x < y) {
      x += 50;
      break;
    }
  }
  int dup = x + 50;
  while (!func(dup)) dup += 100;
  while (!func(x)) x += 100;
  int r = abs(last_x - x);
  int m = abs(dup - last_x);
  while (r % 100 != 0) r += 50;
  while (m % 100 != 0) m += 50;
  cout << min(r / 100, m / 100) << '\n';
  return 0;
}
