#include <bits/stdc++.h>   using namespace std;   long long Deci(int arr[], int base, int n) {     long long power = 1;     long long num = 0;     for (int i = n - 1; i >= 0; i--) {       num += arr[i] * power;       power = power * base;     }     return num;   }   int main() {     int n, m, x, y;     cin >> n >> x;     int arr[n + 3];     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     cin >> m >> y;     int brr[m + 3];     for (int i = 0; i < m; i++) {       cin >> brr[i];     }     long long X = Deci(arr, x, n);     long long Y = Deci(brr, y, m);     if (X < Y)       cout <<  < n ;     else if (X > Y)       cout <<  > n ;     else       cout <<  = n ;   }   