文件目录

#include <bits/stdc++.h>
using namespace std;
int n, v, t;
int main()
{
    while (cin >> n)
    {
        if (!n)
            break;
        int ans = 99999;
        while (n--)
        {
            cin >> v >> t;
            if (t < 0)
                continue;
            int tim = ceil(4.5 / v * 3600) + t;
            ans = min(ans, tim);
        }
        printf("%d\n", ans);
    }
    return 0;
}