#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>

#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

typedef long long ll;
typedef long double ld;

using namespace std;

// векторы значений названий команды и города
vector<string> a, b;

// граф переходов от bi => aj, где b[i] == a[j]
unordered_map<string, vector<int>> b2a;

//посещения вершин при обходе
vector<bool> visitB;

// хеш таблица всех найденных значений
unordered_map<string, int> ht;

bool dfs(int i)
{
	if (ht.find(b[i]) != ht.end())
	{
		return false;
	}

	ht.emplace(b[i], i);
	visitB[i] = true;

	for (int j = 0; j < b2a[b[i]].size(); j++)
	{
		int i2 = b2a[b[i]][j];
		if (!visitB[i2] && !dfs(i2))
			return false;
	}

	return true;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	// cout.setf(ios::fixed);
	// cout.precision(10);

    // ifstream in("3.txt");
    // cin.rdbuf(in.rdbuf());

	int n, s;
	cin >> n >> s;

	vector<int> a(n), p(n);

	rep(i, 0, n)
	{
		cin >> a[i];
	}

	int l = 0;
	int r = n;

	ll sumk = 0;
	while(l < r)
	{
		int k = l + ceil((r - l) * 0.5);

		rep(i, 0, n)
		{
			p[i] = a[i] + k * (i + 1);
		}

		sort(p.begin(), p.end());

		ll sumk2 = 0;
		rep(i, 0, k)
		{
			sumk2 += p[i];
		}

		if (sumk2 > s)
			r = k - 1;
		else
		{
			l = k;
			sumk = sumk2;
		}
	}

	cout << l << " " << sumk << endl;

	return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>

#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

typedef long long ll;
typedef long double ld;

using namespace std;

// векторы значений названий команды и города
vector<string> a, b;

// граф переходов от bi => aj, где b[i] == a[j]
unordered_map<string, vector<int>> b2a;

//посещения вершин при обходе
vector<bool> visitB;

// хеш таблица всех найденных значений
unordered_map<string, int> ht;

bool dfs(int i)
{
	if (ht.find(b[i]) != ht.end())
	{
		return false;
	}

	ht.emplace(b[i], i);
	visitB[i] = true;

	for (int j = 0; j < b2a[b[i]].size(); j++)
	{
		int i2 = b2a[b[i]][j];
		if (!visitB[i2] && !dfs(i2))
			return false;
	}

	return true;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	// cout.setf(ios::fixed);
	// cout.precision(10);

    // ifstream in("4.txt");
    // cin.rdbuf(in.rdbuf());

	int n, s;
	cin >> n >> s;

	vector<ll> a(n), p(n);

	rep(i, 0, n)
	{
		cin >> a[i];
	}

	int l = 0;
	int r = n;

	ll sumk = 0;
	while(l < r)
	{
		int k = l + ceil((r - l) * 0.5);

		rep(i, 0, n)
		{
			p[i] = a[i] + k * (i + 1);
		}

		sort(p.begin(), p.end());

		ll sumk2 = 0;
		rep(i, 0, k)
		{
			sumk2 += p[i];
		}

		if (sumk2 > s)
			r = k - 1;
		else
		{
			l = k;
			sumk = sumk2;
		}
	}

	cout << l << " " << sumk << endl;

	return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>

#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

typedef long long ll;
typedef long double ld;

using namespace std;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	// cout.setf(ios::fixed);
	// cout.precision(10);

    // ifstream in("4.txt");
    // cin.rdbuf(in.rdbuf());

	ll n, s;
	cin >> n >> s;

	vector<ll> a(n), p(n);

	rep(i, 0, n)
	{
		cin >> a[i];
	}

	int l = 0;
	int r = n;

	ll sumk = 0;
	while(l < r)
	{
		int k = l + ceil((r - l) * 0.5);

		rep(i, 0, n)
		{
			p[i] = a[i] + ll(k) * (ll(i) + 1);
		}

		sort(p.begin(), p.end());

		ll sumk2 = 0;
		rep(i, 0, k)
		{
			sumk2 += p[i];
		}

		if (sumk2 > s)
			r = k - 1;
		else
		{
			l = k;
			sumk = sumk2;
		}
	}

	cout << l << " " << sumk << endl;

	return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>

#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

typedef long long ll;
typedef long double ld;

using namespace std;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	// cout.setf(ios::fixed);
	// cout.precision(10);

    // ifstream in("4.txt");
    // cin.rdbuf(in.rdbuf());

	ll n, s;
	cin >> n >> s;

	vector<ll> a(n), p(n);

	rep(i, 0, n)
	{
		cin >> a[i];
	}

	int l = 0;
	int r = n;

	ll sumk = 0;
	while(l < r)
	{
		int k = l + ceil((r - l) * 0.5);

		rep(i, 0, n)
		{
			p[i] = a[i] + k * (i + 1);
		}

		sort(p.begin(), p.end());

		ll sumk2 = 0;
		rep(i, 0, k)
		{
			sumk2 += p[i];
		}

		if (sumk2 > s)
			r = k - 1;
		else
		{
			l = k;
			sumk = sumk2;
		}
	}

	cout << l << " " << sumk << endl;

	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const ll N = 100000;
ll a[N];
ll at[N];
ll n;
ll s;
int main()
{
	cin >> n >> s;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}

	ll cost, c;
	int l = 0, r = n, k, m;
	while (l <= r)
	{
		m = (l + r) / 2;
		for (int i = 1; i <= n; i++)
		{
			at[i] = a[i] +( i * m);
		}
		sort(at, at + n);
		c = 0;
		for (int i = 1; i <= m; i++)
		{
			c += at[i];
		}
		if (c <= s)
		{
			k = m;
			cost = c;
			l = m + 1;
		}
		else
			r = m - 1;
	}
	cout << k << " " << cost << endl;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 100000;
int n, a[N];
ll s;
int main()
{
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int l = 0, r = n, m, k=0;
	ll cost=0;
	while (l <= r)
	{
		m = (l + r) / 2;
		vector<ll>v;
		for (int i = 0; i < n; i++)
		{
			v.push_back(a[i] + (ll)(i+1)*m);
		}
		sort(v.begin(), v.end());
		ll c = 0;
		for (int i = 0; i < m; i++)
		{
			c += v[i];
		}
		if (c <= s)
		{
			k = m;
			cost = c;
			l = m + 1;
		}
		else
			r = m - 1;
	}
	cout << k << " " << cost << endl;
}


#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const ll N = 100000;
ll a[N];
ll at[N];
ll n;
ll s;
int main()
{
	cin >> n >> s;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}

	ll l = 0, r = n, k, m,cost,c;
	while (l <= r)
	{
		m = (l + r) / 2;
		for (int i = 1; i <= n; i++)
		{
			at[i] = a[i] +(ll)( i * m);
		}
		sort(at, at + n);
		c = 0;
		for (int i = 1; i <= m; i++)
		{
			c += at[i];
		}
		if (c <= s)
		{
			k = m;
			cost = c;
			l = m + 1;
		}
		else
			r = m - 1;
	}
	cout << k << " " << cost << endl;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void BinSearch(vector<long long> A, long long minK, long long maxK,long S,long curS, long long curK)
{

	vector<long long> tempA;
	long long k = (minK + maxK) / 2;
	for (long long i = 0; i < A.size(); i++)
	{
		tempA.push_back(A[i] + (i + 1)*k);
	}
	sort(tempA.begin(), tempA.end());
	long Sum = 0;
	for (long long i = 0; i < k; i++)
	{
			Sum += tempA[i];
	}
	long long newMink, newMaxK;
	if (Sum <= S)
	{
		newMink = k+1;
		newMaxK = maxK;
		curK = k;
		curS = Sum;
	}
	else
	{
		newMink = minK;
		newMaxK = k - 1;
	}
	if (minK == maxK)
	{
		cout << curK << ' ' << curS << endl;
		return;
	}
		return BinSearch(A, newMink, newMaxK, S, Sum,curK);
}
using namespace std;
int main()
{
	long long N;
	long long S;
	cin >> N >> S;
	vector<long long> A;
	for (long long i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0, maxI = 0;
    long long CurrentMaxNum=0;

	BinSearch(A, 0, N, S, 0,0);
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	long long N;
	long long  S;
	cin >> N >> S;
	vector<long long > A;
	for (long long  i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0;
	long long maxI = N;
	long long bestK = 0;
	long long bestS = 0;
	bool Calc = 0;
	while (true)
	{

		long long k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (long long i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			if (minI >= maxI)
				break;
			minI = k + 1;
		}
		else
		{
			if (minI >= maxI)
				break;
			maxI = k - 1;
		}

	}

	long long k = minI;
	vector<long long> TempA;
	for (long long i = 0; i < A.size(); i++)
	{
		TempA.push_back(A[i] + (i + 1)*k);
	}
	sort(TempA.begin(), TempA.end());
	long long sum = 0;
	for (long long i = 0; i < k; i++)
	{
		sum += TempA[i];
	}
	if (sum <= S)
	{
		bestK = k;
		bestS = sum;
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using namespace std;
int main()
{
	long long N;
	long long  S;
	cin >> N >> S;
	vector<long long > A;
	for (long long  i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0;
	long long maxI = N;
	long long bestK = 0;
	long long bestS = 0;
	bool Calc = 0;
	while (minI != maxI || Calc)
	{
		long long k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (long long i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (long long i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			minI = k + 1;
		}
		else
		{
			maxI = k - 1;
		}
	}

	long long k = minI;
	vector<long long> TempA;
	for (long long i = 0; i < A.size(); i++)
	{
		TempA.push_back(A[i] + (i + 1)*k);
	}
	sort(TempA.begin(), TempA.end());
	long long sum = 0;
	for (long long i = 0; i < k; i++)
	{
		sum += TempA[i];
	}
	if (sum <= S)
	{
		bestK = k;
		bestS = sum;
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void BinSearch(vector<long long> A, long long minK, long long maxK,long S,long curS, long long curK)
{

	vector<long long> tempA;
	long long k = (minK + maxK) / 2;
	for (long long i = 0; i < A.size(); i++)
	{
		tempA.push_back(A[i] + (i + 1)*k);
	}
	sort(tempA.begin(), tempA.end());
	long Sum = 0;
	for (long long i = 0; i < k; i++)
	{
			Sum += tempA[i];
	}
	long long newMink, newMaxK;
	if (Sum <= S)
	{
		newMink = k+1;
		newMaxK = maxK;
		curK = k;
		curS = Sum;
	}
	else
	{
		newMink = minK;
		newMaxK = k - 1;
	}
	if (minK == maxK)
	{
		cout << curK << ' ' << curS << endl;
		return;
	}
		return BinSearch(A, newMink, newMaxK, S, Sum,curK);
}
using namespace std;
int main()
{
	long long N;
	long long S;
	cin >> N >> S;
	vector<long long> A;
	for (long long i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0, maxI = 0;
    long long CurrentMaxNum=0;

	BinSearch(A, 0, N, S, 0,0);
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int N;
	long S;
	cin >> N >> S;
	vector<int> A;
	for (int i = 0; i < N; i++)
	{
		int m;
		cin >> m;
		A.push_back(m);
	}
	sort(A.begin(), A.end());
	int k = 0;
	long money = 0 ,tempMoney = 0 , newOth = 0;
	for (int i = 0; i < N; i++)
	{
		tempMoney = money + A[i];
		newOth = (i + 1)*(i + 2)*(i+1)/2;
		if (tempMoney + newOth <= S)
		{
			money = tempMoney;
			k = i+1;
		}
	}
	newOth = k*(k+1)*(k) / 2;
	cout << k << ' ' << money + newOth << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using namespace std;
int main()
{
	long long N;
	long long  S;
	cin >> N >> S;
	vector<long long > A;
	for (long long  i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0;
	long long maxI = N;
	long long bestK = 0;
	long long bestS = 0;
	bool Calc = 0;
	while (minI != maxI || Calc)
	{
		long long k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (long long i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			minI = k + 1;
		}
		else
		{
			maxI = k - 1;
		}
	}

	long long k = minI;
	vector<long long> TempA;
	for (long long i = 0; i < A.size(); i++)
	{
		TempA.push_back(A[i] + (i + 1)*k);
	}
	sort(TempA.begin(), TempA.end());
	long long sum = 0;
	for (long long i = 0; i < k; i++)
	{
		sum += TempA[i];
	}
	if (sum <= S)
	{
		bestK = k;
		bestS = sum;
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	long long N;
	long long  S;
	cin >> N >> S;
	vector<long long > A;
	for (long long  i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0;
	long long maxI = N;
	long long bestK = 0;
	long long bestS = 0;
	while (true)
	{

		long long k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (long long i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			if (minI >= maxI)
				break;
			minI = k + 1;
		}
		else
		{
			if (minI >= maxI)
				break;
			maxI = k - 1;
		}

	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using namespace std;
int main()
{
	int N;
	long  S;
	cin >> N >> S;
	vector<long > A;
	for (long  i = 0; i < N; i++)
	{
		int m;
		cin >> m;
	    A.push_back(m);
	}
	int minI = 0;
	int maxI = N;
	int bestK = 0;
	long long bestS = 0;
	bool Calc = 0;
	while (minI != maxI || Calc)
	{
		int k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (int i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			minI = k + 1;
		}
		else
		{
			maxI = k - 1;
		}
	}

	int k = minI;
	vector<long long> TempA;
	for (int i = 0; i < A.size(); i++)
	{
		TempA.push_back(A[i] + (i + 1)*k);
	}
	sort(TempA.begin(), TempA.end());
	long long sum = 0;
	for (int i = 0; i < k; i++)
	{
		sum += TempA[i];
	}
	if (sum <= S)
	{
		bestK = k;
		bestS = sum;
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using namespace std;
int main()
{
	int N;
	long  S;
	cin >> N >> S;
	vector<long > A;
	for (long  i = 0; i < N; i++)
	{
		int m;
		cin >> m;
	    A.push_back(m);
	}
	int minI = 0;
	int maxI = N;
	int bestK = 0;
	long long bestS = 0;
	while (minI != maxI)
	{
		int k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (int i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			minI = k + 1;
		}
		else
		{
			maxI = k - 1;
		}
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using namespace std;
int main()
{
	int N;
	long  S;
	cin >> N >> S;
	vector<long > A;
	for (long  i = 0; i < N; i++)
	{
		int m;
		cin >> m;
	    A.push_back(m);
	}
	int minI = 0;
	int maxI = N;
	int bestK = 0;
	long long bestS = 0;
	bool Calc = 0;
	while (minI != maxI || Calc)
	{
		int k = (minI + maxI) / 2;
		vector<long long> TempA;
		for (int i = 0; i < A.size(); i++)
		{
			TempA.push_back(A[i] + (i + 1)*k);
		}
		sort(TempA.begin(), TempA.end());
		long long sum = 0;
		for (int i = 0; i < k; i++)
		{
			sum += TempA[i];
		}
		if (sum <= S)
		{
			bestK = k;
			bestS = sum;
			minI = k + 1;
		}
		else
		{
			maxI = k - 1;
		}
	}

	int k = minI;
	vector<long long> TempA;
	for (int i = 0; i < A.size(); i++)
	{
		TempA.push_back(A[i] + (i + 1)*k);
	}
	sort(TempA.begin(), TempA.end());
	long long sum = 0;
	for (int i = 0; i < k; i++)
	{
		sum += TempA[i];
	}
	if (sum <= S)
	{
		bestK = k;
		bestS = sum;
	}
	cout << bestK << ' ' << bestS << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int N;
	long S;
	cin >> N >> S;
	vector<int> A;
	for (int i = 0; i < N; i++)
	{
		int m;
		cin >> m;
		A.push_back(m);
	}
	sort(A.begin(), A.end());
	int k = 0;
	long money = 0 ,tempMoney = 0 , newOth = 0;
	for (int i = 0; i < N; i++)
	{
		tempMoney = money + A[i];
		newOth = (i + 1)*(i + 2)*(i+1)/2;
		if (tempMoney + newOth <= S)
		{
			money = tempMoney;
			k = i+1;
		}
	}
	newOth = k*(k+1)*(k) / 2;
	cout << k << ' ' << money + newOth << endl;
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry polong long for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void BinSearch(vector<long long> A, long long minK, long long maxK,long S,long curS, long long curK)
{

	vector<long long> tempA;
	long long k = (minK + maxK) / 2;
	for (long long i = 0; i < A.size(); i++)
	{
		tempA.push_back(A[i] + (i + 1)*k);
	}
	sort(tempA.begin(), tempA.end());
	long Sum = 0;
	for (long long i = 0; i < k; i++)
	{
			Sum += tempA[i];
	}
	long long newMink, newMaxK;
	if (Sum <= S)
	{
		newMink = k+1;
		newMaxK = maxK;
		curK = k;
		curS = Sum;
	}
	else
	{
		newMink = minK;
		newMaxK = k - 1;
	}
	if (minK == maxK)
	{
		cout << curK << ' ' << curS << endl;
		return;
	}
		return BinSearch(A, newMink, newMaxK, S, curS, curK);
}
using namespace std;
int main()
{
	long long N;
	long long S;
	cin >> N >> S;
	vector<long long> A;
	for (long long i = 0; i < N; i++)
	{
		long long m;
		cin >> m;
	    A.push_back(m);
	}
	long long minI = 0, maxI = 0;
    long long CurrentMaxNum=0;

	BinSearch(A, 0, N, S, 0,0);
    return 0;
}


// ConsoleApplication7.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void BinSearch(vector<long> A, int minK, int maxK,long S,long curS, int curK)
{

	vector<long> tempA;
	int k = (minK + maxK) / 2;
	for (int i = 0; i < A.size(); i++)
	{
		tempA.push_back(A[i] + (i + 1)*k);
	}
	sort(tempA.begin(), tempA.end());
	long Sum = 0;
	for (int i = 0; i < k; i++)
	{
			Sum += tempA[i];
	}
	int newMink, newMaxK;
	if (Sum <= S)
	{
		newMink = k+1;
		newMaxK = maxK;
		curK = k;
		curS = Sum;
	}
	else
	{
		newMink = minK;
		newMaxK = k - 1;
	}
	if (minK == maxK)
	{
		cout << curK << ' ' << curS << endl;
		return;
	}
		return BinSearch(A, newMink, newMaxK, S, Sum,curK);
}
using namespace std;
int main()
{
	int N;
	long S;
	cin >> N >> S;
	vector<long> A;
	for (int i = 0; i < N; i++)
	{
		int m;
		cin >> m;
	    A.push_back(m);
	}
	int minI = 0, maxI = 0;
    long CurrentMaxNum=0;

	BinSearch(A, 0, N, S, 0,0);
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define ll long long
const ll mod = 1e9 + 7;
using namespace std;

int n, s, a[100001], mx = 0, mn = 1e9;

int main()
{
	cin >> n >> s;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int k = 1; k <= n; k++)
	{
		int b[100001] = {}, sum = 0;
		for (int i = 1; i <= n; i++)
			b[i] = a[i] + i * k;
		sort(b + 1, b + n + 1);
		for (int i = 1; i <= k; i++)
			sum += b[i];
		if (sum <= s && (k > mx || sum < mn))
			mx = k, mn = sum;
	}
	if (mn == 1e9)
		mn = 0;
	cout << mx << ' ' << mn;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define ll long long
const ll mod = 1e9 + 7;
using namespace std;

int main()
{
	int n, s, a[100001], mx = 0, mn = 0;
	cin >> n >> s;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int k = 1; k <= n; k++)
	{
		int b[100001] = {}, sum = 0;
		for (int i = 1; i <= n; i++)
			b[i] = a[i] + i * k;
		sort(b + 1, b + n + 1);
		for (int i = 1; i <= k; i++)
			sum += b[i];
		if (sum <= s && (k > mx || sum < mn))
			mx = k, mn = sum;
		else if (sum > s)
			break;
	}
	cout << mx << ' ' << mn;
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

struct elem
{
	int value;
	int j;
};

int sorting_m = 0;
bool all_same = true;

int get_cost(const int x, const int n, const elem* a, const int max_m)
{
	auto acc = 0;
	for (auto i = 0; i < n; ++i)
	{
		acc += a[i].value + a[i].j * x;

		if (acc > max_m) return 0;

		if (x - 1 == i)
		{
			return acc;
		}
	}
	return 0;
}

bool smaller(elem l, elem r)
{
	return l.value + l.j * sorting_m < r.value + r.j * sorting_m;
}

int  main()
{
	int n, s;
	cin >> n >> s;

	auto a = new elem[n];
	auto prev = 0;
	for (auto i = 0; i < n; ++i)
	{
		auto val = 0;
		cin >> val;
		all_same = prev == 0 || all_same && prev == val;
		elem elem{};
		elem.value = val;
		elem.j = i + 1;
		a[i] = elem;
		prev = val;
	}

	auto ans = 0;
	auto cost = 0;

	//search
	auto left = 1, right = n;
	while (left <= right) {
		const auto mid = (left + right) / 2;

		auto temp_cost = 0;
		sorting_m = mid;
			sort(a, a + n, &smaller);
		if ((temp_cost = get_cost(mid, n, a, s))) {
			left = mid + 1;
			ans = mid;
			cost = temp_cost;
		}
		else {
			right = mid - 1;
		}
	}
	cout << ans << " " << cost << endl;

	return 0;
}


#include <iostream>

using namespace std;

int get_cost(const int x, const int n, const int* a, const int max_m)
{
	auto acc = 0;

	for (auto i = 0; i < n; ++i)
	{
		acc += a[i] + (i + 1) * x;

		if (acc > max_m) return 0;

		if (x - 1 == i)
		{
			return acc;
		}
	}
	return 0;
}

int  main()
{
	int n, s;
	cin >> n >> s;

	auto a = new int[n];
	for (auto i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	auto ans = 0;
	auto cost = 0;

	//search
	auto left = 1, right = n;
	while (left <= right) {
		const auto mid = (left + right) / 2;

		auto temp_cost = 0;
		if ((temp_cost = get_cost(mid, n, a, s))) {
			left = mid + 1;
			ans = mid;
			cost = temp_cost;
		}
		else {
			right = mid - 1;
		}
	}
	cout << ans << " " << cost << endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

struct elem
{
	int value;
	int j;
};

int sorting_m = 0;

int get_cost(const int x, const int n, const elem* a, const int max_m)
{
	auto acc = 0;
	auto prev = 0;
	for (auto i = 0; i < n; ++i)
	{
		if (a[i].value == prev) {
			continue;
		}

		acc += a[i].value + a[i].j * x;

		if (acc > max_m) return 0;

		if (x - 1 == i)
		{
			return acc;
		}
		prev = a[i].value;
	}
	return 0;
}

bool smaller(elem l, elem r)
{
	return l.value + l.j * sorting_m < r.value + r.j * sorting_m;
}

int  main()
{
	int n, s;
	cin >> n >> s;

	auto a = new elem[n];
	for (auto i = 0; i < n; ++i)
	{
		auto val = 0;
		cin >> val;
		elem elem{};
		elem.value = val;
		elem.j = i + 1;
		a[i] = elem;
	}

	auto ans = 0;
	auto cost = 0;

	//search
	auto left = 1, right = n;
	while (left <= right) {
		const auto mid = (left + right) / 2;

		auto temp_cost = 0;
		sorting_m = mid;
		sort(a, a + n, &smaller);
		if ((temp_cost = get_cost(mid, n, a, s))) {
			left = mid + 1;
			ans = mid;
			cost = temp_cost;
		}
		else {
			right = mid - 1;
		}
	}
	cout << ans << " " << cost << endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

struct elem
{
	int value;
	int j;
};

int sorting_m = 0;
bool all_same = true;

int get_cost(const int x, const int n, const elem* a, const int max_m)
{
	auto acc = 0;
	auto prev = 0;
	for (auto i = 0; i < n; ++i)
	{
		if (!all_same && a[i].value == prev) {
			continue;
		}

		acc += a[i].value + a[i].j * x;

		if (acc > max_m) return 0;

		if (x - 1 == i)
		{
			return acc;
		}
		prev = a[i].value;
	}
	return 0;
}

bool smaller(elem l, elem r)
{
	return l.value + l.j * sorting_m < r.value + r.j * sorting_m;
}

int  main()
{
	int n, s;
	cin >> n >> s;

	auto a = new elem[n];
	auto prev = 0;
	for (auto i = 0; i < n; ++i)
	{
		auto val = 0;
		cin >> val;
		all_same = prev == 0 || all_same && prev == val;
		elem elem{};
		elem.value = val;
		elem.j = i + 1;
		a[i] = elem;
		prev = val;
	}

	auto ans = 0;
	auto cost = 0;

	//search
	auto left = 1, right = n;
	while (left <= right) {
		const auto mid = (left + right) / 2;

		auto temp_cost = 0;
		sorting_m = mid;
		sort(a, a + n, &smaller);
		if ((temp_cost = get_cost(mid, n, a, s))) {
			left = mid + 1;
			ans = mid;
			cost = temp_cost;
		}
		else {
			right = mid - 1;
		}
	}
	cout << ans << " " << cost << endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

struct elem
{
	int value;
	int j;
};

int sorting_m = 0;

int get_cost(const int x, const int n, const elem* a, const int max_m)
{
	auto acc = 0;
	for (auto i = 0; i < n; ++i)
	{
		acc += a[i].value + a[i].j * x;

		if (acc > max_m) return 0;

		if (x - 1 == i)
		{
			return acc;
		}
	}
	return 0;
}

bool smaller(elem l, elem r)
{
	return l.value + l.j * sorting_m < r.value + r.j * sorting_m;
}

int  main()
{
	int n, s;
	cin >> n >> s;

	auto a = new elem[n];
	for (auto i = 0; i < n; ++i)
	{
		auto val = 0;
		cin >> val;
		elem elem{};
		elem.value = val;
		elem.j = i + 1;
		a[i] = elem;
	}

	auto ans = 0;
	auto cost = 0;

	//search
	auto left = 1, right = n;
	while (left <= right) {
		const auto mid = (left + right) / 2;

		auto temp_cost = 0;
		sorting_m = mid;
			sort(a, a + n, &smaller);
		if ((temp_cost = get_cost(mid, n, a, s))) {
			left = mid + 1;
			ans = mid;
			cost = temp_cost;
		}
		else {
			right = mid - 1;
		}
	}
	cout << ans << " " << cost << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <math.h>
#include <map>
#include <queue>
#include <deque>
#include <time.h>
#include <set>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <list>
#include <fstream>
#include <utility>
#include <algorithm>

using namespace std;

long long f(vector<int> &a, int k, int n) {
	long long res = 0;
	vector <long long> b;
	for (int i = 0; i < n; i++) {
		b.push_back(a[i] + (i + 1) * k);
	}

	sort(b.begin(), b.end());
	for (int i = 0; i < k; i++)
		res += b[i];
	return res;
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);

	int n, S;
	cin >> n >> S;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int left = -1, right = n;
	while (right - left > 1) {
		int middle = (left + right) / 2;
		if (f(a, middle, n) <= S) {
			left = middle;
		}
		else {
			right = middle;
		}
	}
	if (f(a, right, n) <= S && f(a, left, n) <= S) {
		cout << max(left, right) << ' ' << f(a, max(right, left), n);
	}
	else if (f(a, right, n) <= S)
		cout << right << ' ' << f(a, right, n) << ' ';
	else {
		cout << left << ' ' << f(a, left, n) << ' ';
	}
	return 0;
}


#include <iostream>
int main() {
	std::cout << "HELLO WORLD!";
	return 0;
}


#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <math.h>
#include <map>
#include <queue>
#include <deque>
#include <time.h>
#include <set>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <list>
#include <fstream>
#include <utility>
#include <algorithm>

using namespace std;

long long f(vector<long long> &a, long long k, long long n) {
	long long res = 0;
	vector <long long> b;
	for (long long i = 0; i < n; i++) {
		b.push_back(a[i] + (i + 1) * k);
	}

	sort(b.begin(), b.end());
	for (long long i = 0; i < k; i++)
		res += b[i];
	return res;
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);

	long long n, S;
	cin >> n >> S;
	vector <long long> a(n);
	for (long long i = 0; i < n; i++)
		cin >> a[i];
	long long left = -1, right = n;
	while (right - left > 1) {
		long long middle = (left + right) / 2;
		if (f(a, middle, n) <= S) {
			left = middle;
		}
		else {
			right = middle;
		}
	}
	if (f(a, right, n) <= S && f(a, left, n) <= S) {
		cout << max(left, right) << ' ' << f(a, max(right, left), n);
	}
	else if (f(a, right, n) <= S)
		cout << right << ' ' << f(a, right, n) << ' ';
	else {
		cout << left << ' ' << f(a, left, n) << ' ';
	}
	return 0;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include<string>
#include <cstring>
#include<vector>
#include<set>
#include<list>
#include<map>
#include<algorithm>
#include<cmath>
#include <numeric>
#include <fstream>
#include<iomanip>
#include<unordered_map>
#include<queue>
#include<sstream>

#define DEBUG true
#define deb(x)   \
    if (DEBUG) \
        cout << #x << " " << x << '\n';
#define debarr(arrayName, n)               \
    if (DEBUG)                           \
    {                                    \
        cout << #arrayName << " ";       \
        for (ll i = 0; i < n; i++)       \
            cout << arrayName[i] << " "; \
        cout << '\n';                    \
    }
#define debv(vec)               \
    if (DEBUG)                \
    {                         \
        cout << #vec << " ";  \
        for (auto x : vec)    \
            cout << x << " "; \
        cout << '\n';         \
    }

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

const double pi = (double)2 * acos(0.0);
#define rep(i,n) for(auto i=0;i<n;i++)
#define fi first
#define se second
ll n, s;
vector<ll> a;
ll tot; int cnt;

bool isok(int size) {
    vector<ll> temp(n);
    rep(i, n)temp[i] = a[i] + (i + 1) *(ll)size;
    sort(temp.begin(), temp.end());
    tot = 0; cnt = 0;
    for (int i = 0; i < n; i++) {
        if (tot + temp[i] <= s) {
            tot = tot + temp[i];
            cnt++;
        }
        else break;
    }
    return cnt >= size;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> s;
    a.assign(n,0);
    rep(i, n)cin >> a[i];
    int l = 1; int h = n;
    while (h - l > 1) {
        int mid = l + (h - l) / 2;
        if (isok(mid)) {
            l = mid;
        }
        else {
            h = mid;
        }
    }
    if (isok(h)) {
        cout << h << " " << tot << endl;
    }
    else if (isok(l)) {

        cout << l << " " << tot << endl;
    }
    else cout << 0 << " " << 0 << endl;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include<string>
#include <cstring>
#include<vector>
#include<set>
#include<list>
#include<map>
#include<algorithm>
#include<cmath>
#include <numeric>
#include <fstream>
#include<iomanip>
#include<unordered_map>
#include<queue>
#include<sstream>

#define DEBUG true
#define deb(x)   \
    if (DEBUG) \
        cout << #x << " " << x << '\n';
#define debarr(arrayName, n)               \
    if (DEBUG)                           \
    {                                    \
        cout << #arrayName << " ";       \
        for (ll i = 0; i < n; i++)       \
            cout << arrayName[i] << " "; \
        cout << '\n';                    \
    }
#define debv(vec)               \
    if (DEBUG)                \
    {                         \
        cout << #vec << " ";  \
        for (auto x : vec)    \
            cout << x << " "; \
        cout << '\n';         \
    }

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

const double pi = (double)2 * acos(0.0);
#define rep(i,n) for(auto i=0;i<n;i++)
#define fi first
#define se second
ll n, s;
vector<ll> a;
ll tot; int cnt;

bool isok(int size) {
    vector<ll> temp(n);
    rep(i, n)temp[i] = a[i] + (i + 1) *(ll)size;
    sort(temp.begin(), temp.end());
    tot = 0; cnt = 0;
    for (int i = 0; i < n; i++) {
        if (tot + temp[i] <= s) {
            tot = tot + temp[i];
            cnt++;
        }
        else break;
    }
    return cnt >= size;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> s;
    a.assign(n,0);
    rep(i, n)cin >> a[i];
    int l = 0; int h = n;
    while (h - l > 1) {
        int mid = l + (h - l) / 2;
        if (isok(mid)) {
            l = mid;
        }
        else {
            h = mid;
        }
    }
    if (isok(h)) {
        cout << h << " " << tot << endl;
    }
    else{
        isok(l);
        cout << l << " " << tot << endl;
    }
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include<string>
#include <cstring>
#include<vector>
#include<set>
#include<list>
#include<map>
#include<algorithm>
#include<cmath>
#include <numeric>
#include <fstream>
#include<iomanip>
#include<unordered_map>
#include<queue>
#include<sstream>

#define DEBUG true
#define deb(x)   \
    if (DEBUG) \
        cout << #x << " " << x << '\n';
#define debarr(arrayName, n)               \
    if (DEBUG)                           \
    {                                    \
        cout << #arrayName << " ";       \
        for (ll i = 0; i < n; i++)       \
            cout << arrayName[i] << " "; \
        cout << '\n';                    \
    }
#define debv(vec)               \
    if (DEBUG)                \
    {                         \
        cout << #vec << " ";  \
        for (auto x : vec)    \
            cout << x << " "; \
        cout << '\n';         \
    }

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

const double pi = (double)2 * acos(0.0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define fi first
#define se second
ll n, s;
vector<ll> a;
ll tot; int cnt;

bool isok(int size) {
    vector<ll> temp(n);
    rep(i, n)temp[i] = a[i] + (ll)(i + 1) *(ll)size;
    sort(temp.begin(), temp.end());
    tot = 0; cnt = 0;
    for (int i = 0; i < n; i++) {
        if (tot + temp[i] <= s) {
            tot = tot + temp[i];
            cnt++;
        }
        else break;
    }
    return cnt >= size;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> s;
    a.assign(n,0);
    rep(i, n)cin >> a[i];
    int l = 1; int h = n;
    while (h - l > 1) {
        int mid = l + (h - l) / 2;
        if (isok(mid)) {
            l = mid;
        }
        else {
            h = mid;
        }
    }
    if (isok(h)) {
        cout << h << " " << tot << endl;
    }
    else if (isok(l)) {

        cout << l << " " << tot << endl;
    }
    else cout << 0 << " " << 0 << endl;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include<string>
#include <cstring>
#include<vector>
#include<set>
#include<list>
#include<map>
#include<algorithm>
#include<cmath>
#include <numeric>
#include <fstream>
#include<iomanip>
#include<unordered_map>
#include<queue>
#include<sstream>

#define DEBUG true
#define deb(x)   \
    if (DEBUG) \
        cout << #x << " " << x << '\n';
#define debarr(arrayName, n)               \
    if (DEBUG)                           \
    {                                    \
        cout << #arrayName << " ";       \
        for (ll i = 0; i < n; i++)       \
            cout << arrayName[i] << " "; \
        cout << '\n';                    \
    }
#define debv(vec)               \
    if (DEBUG)                \
    {                         \
        cout << #vec << " ";  \
        for (auto x : vec)    \
            cout << x << " "; \
        cout << '\n';         \
    }

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

const double pi = (double)2 * acos(0.0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define fi first
#define se second
ll n, s;
vector<ll> a;
ll tot; int cnt;

bool isok(int size) {
    vector<ll> temp(n);
    rep(i, n)temp[i] = a[i] + (ll)(i + 1) *(ll)size;
    sort(temp.begin(), temp.end());
    tot = 0; cnt = 0;
    for (int i = 0; i < size; i++) {
        tot = tot + temp[i];
    }
    return s>=tot;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> s;
    a.assign(n,0);
    rep(i, n)cin >> a[i];
    int l = 1; int h = n;
    while (h - l > 1) {
        int mid = l + (h - l) / 2;
        if (isok(mid)) {
            l = mid;
        }
        else {
            h = mid;
        }
    }
    if (isok(h)) {
        cout << h << " " << tot << endl;
    }
    else if (isok(l)) {

        cout << l << " " << tot << endl;
    }
    else cout << 0 << " " << 0 << endl;
}


#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<deque>
#include<bitset>
#include<iostream>
using namespace std;
typedef long long int ll;
struct node{
	int v;
	int p;
	node(int a=0,int b=0):v(a),p(b){}
};
int k;
vector<node>q;
bool cmp(const node &a,const node &b){
	return (ll)a.v+k*a.p<(ll)b.v+k*b.p;
}
int main(){
	int n,x;ll sum;
	while(scanf("%d%lld",&n,&sum)!=EOF){
		q.clear();
		for(int i=1;i<=n;i++){
			scanf("%d",&x);
			q.push_back(node(x,i));
		}
		ll sum1;
		int low=0;
		int hign=n;
		while(low<=hign){
			int mid=(low+hign)/2;
			k=mid;
			sum1=0;
			sort(q.begin(),q.end(),cmp);
			for(int i=0;i<mid;i++){
				sum1+=q[i].v+k*q[i].p;
			}
			if(sum1<=sum)low=mid+1;
			else hign=mid-1;
		}
		k=hign;
		sum1=0;
		sort(q.begin(),q.end(),cmp);
		for(int i=0;i<k;i++){
			sum1+=q[i].v+k*q[i].p;
		}
		printf("%d %lld\n",hign,sum1);
	}
}


#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<deque>
#include<bitset>
#include<iostream>
using namespace std;
typedef long long int ll;
struct node{
	int v;
	int p;
	node(int a=0,int b=0):v(a),p(b){}
};
int k;
vector<node>q;
bool cmp(const node &a,const node &b){
	return a.v+k*a.p<b.v+k*b.p;
}
int main(){
	int n,x;ll sum;
	while(scanf("%d%lld",&n,&sum)!=EOF){
		q.clear();
		for(int i=1;i<=n;i++){
			scanf("%d",&x);
			q.push_back(node(x,i));
		}
		ll sum1;
		int low=0;
		int hign=n;
		while(low<=hign){
			int mid=(low+hign)/2;
			k=mid;
			sum1=0;
			sort(q.begin(),q.end(),cmp);
			for(int i=0;i<mid;i++){
				sum1+=q[i].v+k*q[i].p;
			}
			if(sum1<=sum)low=mid+1;
			else hign=mid-1;
		}
		k=hign;
		sum1=0;
		sort(q.begin(),q.end(),cmp);
		for(int i=0;i<k;i++){
			sum1+=q[i].v+k*q[i].p;
		}
		printf("%d %lld\n",hign,sum1);
	}
}


#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<deque>
#include<bitset>
#include<iostream>
using namespace std;
typedef long long int ll;
struct node{
	int v;
	int p;
	node(int a=0,int b=0):v(a),p(b){}
};
int k;
vector<node>q;
bool cmp(const node &a,const node &b){
	return (ll)a.v+(ll)k*a.p<(ll)b.v+(ll)k*b.p;
}
int main(){
	int n,x;ll sum;
	while(scanf("%d%lld",&n,&sum)!=EOF){
		q.clear();
		for(int i=1;i<=n;i++){
			scanf("%d",&x);
			q.push_back(node(x,i));
		}
		ll sum1;
		int low=0;
		int hign=n;
		while(low<=hign){
			int mid=(low+hign)/2;
			k=mid;
			sum1=0;
			sort(q.begin(),q.end(),cmp);
			for(int i=0;i<mid;i++){
				sum1+=(ll)q[i].v+(ll)k*q[i].p;
			}
			if(sum1<=sum)low=mid+1;
			else hign=mid-1;
		}
		k=hign;
		sum1=0;
		sort(q.begin(),q.end(),cmp);
		for(int i=0;i<k;i++){
			sum1+=(ll)q[i].v+(ll)k*q[i].p;
		}
		printf("%d %lld\n",hign,sum1);
	}
}


#include<bits/stdc++.h>
using namespace std;

map<set<int>, int> m1;
int c1;
map<string, int> m2;
int c2;
map<string, int> m3;
int c3;
set<int> a[100000 + 10];
vector<int> ans[100000 + 10];
string hostname[100000 + 10];
int n;

int main()
{
      ios::sync_with_stdio(false);
      cin >> n;
      for(int i = 0; i < n; i++)
      {
            string str;
            cin >> str;
            int pt;
            for(pt = 7; pt < str.length(); pt++) if(str[pt] == '/') break;
            string tmp = str.substr(pt, str.length() - pt);
            string host = str.substr(7, pt - 7);
            if(!m2[tmp]) m2[tmp] = ++c2;
            if(!m3[host]) m3[host] = ++c3, hostname[c3] = host;
            a[m3[host]].insert(m2[tmp]);
      }
      for(int i = 1; i <= c3; i++)
      {
            if(!m1[a[i]]) m1[a[i]] = ++c1;
            int t = m1[a[i]];
            ans[t].push_back(i);
      }
      int cnt = 0;
      for(int i = 1; i <= c1; i++) if(ans[i].size() > 1) cnt++;
      cout << cnt << endl;
      for(int i = 1; i <= c1; i++)
      {
            if(ans[i].size() > 1)
                  for(int j = 0; j < ans[i].size(); j++)
                        cout <<"http://"<<hostname[ans[i][j]] << " ";
            cout << endl;
      }
      return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>

int n;
char ad[100000][60];
int idx1[100000];
int nn;
char ad2[100000][60];
char host[100000][30];
char path[100000][30];
int hs[100000];
int n3;
int idx2[100000];
int ll[100000];
int k;
int hs2[100000];
int k2;
int ll2[100000];

int cmp1(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	return strcmp(ad[i1], ad[i2]);
}

int cmp2(const void *aa, const void *bb)
{
	int i;
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

int comp(int i1, int i2)
{
	int i;
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

void solve()
{
	int i, j;
	for(i=0; i<n; i++)
		idx1[i] = i;
	qsort(idx1, n , sizeof(int), cmp1);
	strcpy(ad2[0], ad[idx1[0]]);
	nn = 1;
	for(i=1; i<n; i++){
		if(strcmp(ad[idx1[i-1]], ad[idx1[i]]) != 0){
			strcpy(ad2[nn], ad[idx1[i]]);
			nn ++;
		}
	}
	for(i=0; i<nn; i++){
		char *p1 = strchr(ad2[i], '/');
		p1 += 2;
		char *p = strchr(p1, '/');
		if(p == 0){
			strcpy(host[i], p1);
			path[i][0] = 0;
		}
		else{
			strncpy(host[i], p1, p-p1);
			host[i][p-p1] = 0;
			strcpy(path[i], p);
		}
	}
	n3 = 0;
	hs[n3] = 0;
	n3 ++;
	for(i=1; i<nn; i++){
		if(strcmp(host[i], host[i-1]) != 0){
			hs[n3] = i;
			n3 ++;
		}
	}
	for(i=0; i<n3-1; i++){
		ll[i] = hs[i+1] - hs[i];
	}
	ll[i] = nn - hs[i];
	for(i=0; i<n3; i++)
		idx2[i] = i;
	qsort(idx2, n3, sizeof(int), cmp2);//常用排序来寻找相同值，对所有host进行包括path的排序
	k2 = 0;
	hs2[k2] = 0;
	k2 ++;
	for(i=1; i<n3; i++){
		if(comp(idx2[i], idx2[i-1]) != 0){
			hs2[k2] = i;
			k2 ++;
		}
	}
	k = 0;
	for(i=0; i<k2-1; i++){
		ll2[i] = hs2[i+1] - hs2[i];
	}
	ll2[i] = n3 - hs2[i];
	for(i=0; i<k2; i++){
		if(ll2[i] > 1)
			k ++;
	}
	printf("%d\n", k);
	for(i=0; i<k2; i++){
		if(ll2[i] > 1){
			printf("http://%s", host[hs[idx2[hs2[i]]]]);//
			for(j=1; j<ll2[i]; j++){
				printf(" http://%s", host[hs[idx2[hs2[i]+j]]]);
			}
			printf("\n");
		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++)
		scanf("%s", &ad[i]);
	solve();
	return 0;
}
/*
http://abacaba.com
http://abacaba.com/
http://abacaba.com/t
http://abacaba.com/test
http://abacaba.de/
http://abacaba.de/test
http://abacaba.ru/
http://abacaba.ru/test
hs : 0, 4, 6

ll : 4 2 2

idx2 : 1 2 0

hs2 : 0 2
输出时
*/


#include <cstdio>
#include <cstdlib>
#include <cstring>

int n;
char ad[100000][60];
int idx1[100000];
int nn;
char ad2[100000][60];
char host[100000][30];
char path[100000][30];
int hs[100000];
int n3;
int idx2[100000];
int ll[100000];
int k;
int hs2[100000];
int k2;
int ll2[100000];
char host1[100000][30];
char path1[100000][30];

int cmp1(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	return strcmp(ad[i1], ad[i2]);
}

int cmp3(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	int cp = strcmp(host1[i1], host1[i2]);
	if(cp > 0)
		return 1;
	else if(cp < 0)
		return -1;
	else{
		return strcmp(path1[i1], path1[i2]);
	}
}

int cmp2(const void *aa, const void *bb)
{
	int i;
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

int comp(int i1, int i2)
{
	int i;
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

void solve()
{
	int i, j;
	/*for(i=0; i<n; i++)
		idx1[i] = i;
	qsort(idx1, n , sizeof(int), cmp1);
	strcpy(ad2[0], ad[idx1[0]]);
	nn = 1;
	for(i=1; i<n; i++){
		if(strcmp(ad[idx1[i-1]], ad[idx1[i]]) != 0){
			strcpy(ad2[nn], ad[idx1[i]]);
			nn ++;
		}
	}
	for(i=0; i<nn; i++){
		char *p1 = strchr(ad2[i], '/');
		p1 += 2;
		char *p = strchr(p1, '/');
		if(p == 0){
			strcpy(host[i], p1);
			path[i][0] = 0;
		}
		else{
			strncpy(host[i], p1, p-p1);
			host[i][p-p1] = 0;
			strcpy(path[i], p);
		}
	}*/
	for(i=0; i<n; i++)
		idx1[i] = i;
	qsort(idx1, n , sizeof(int), cmp1);
	strcpy(ad2[0], ad[idx1[0]]);
	nn = 1;
	for(i=1; i<n; i++){
		if(strcmp(ad[idx1[i-1]], ad[idx1[i]]) != 0){
			strcpy(ad2[nn], ad[idx1[i]]);
			nn ++;
		}
	}
	for(i=0; i<nn; i++){
		char *p1 = strchr(ad2[i], '/');
		p1 += 2;
		char *p = strchr(p1, '/');
		if(p == 0){
			strcpy(host1[i], p1);
			path1[i][0] = 0;
		}
		else{
			strncpy(host1[i], p1, p-p1);
			host1[i][p-p1] = 0;
			strcpy(path1[i], p);
		}
	}
	for(i=0; i<nn; i++){
		idx1[i] = i;
	}
	qsort(idx1, nn , sizeof(int), cmp3);
	for(i=0; i<nn; i++){
		strcpy(host[i], host1[idx1[i]]);
		strcpy(path[i], path1[idx1[i]]);
	}

	n3 = 0;
	hs[n3] = 0;
	n3 ++;
	for(i=1; i<nn; i++){
		if(strcmp(host[i], host[i-1]) != 0){
			hs[n3] = i;
			n3 ++;
		}
	}
	for(i=0; i<n3-1; i++){
		ll[i] = hs[i+1] - hs[i];
	}
	ll[i] = nn - hs[i];
	for(i=0; i<n3; i++)
		idx2[i] = i;
	qsort(idx2, n3, sizeof(int), cmp2);//常用排序来寻找相同值，对所有host进行包括path的排序
	k2 = 0;
	hs2[k2] = 0;
	k2 ++;
	for(i=1; i<n3; i++){
		if(comp(idx2[i], idx2[i-1]) != 0){
			hs2[k2] = i;
			k2 ++;
		}
	}
	k = 0;
	for(i=0; i<k2-1; i++){
		ll2[i] = hs2[i+1] - hs2[i];
	}
	ll2[i] = n3 - hs2[i];
	for(i=0; i<k2; i++){
		if(ll2[i] > 1)
			k ++;
	}
	printf("%d\n", k);
	for(i=0; i<k2; i++){
		if(ll2[i] > 1){
			printf("http://%s", host[hs[idx2[hs2[i]]]]);//
			for(j=1; j<ll2[i]; j++){
				printf(" http://%s", host[hs[idx2[hs2[i]+j]]]);
			}
			printf("\n");
		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++)
		scanf("%s", &ad[i]);
	solve();
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b>a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b<a)a = b; }
const int N = 1e5+10, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
int casenum, casei;
int n;
char a[N][50],s[50];
map<string, set<string> > SerToPath;
map<set<string>, set<string> > PathToSer;
map<set<string>, set<string> >::iterator it;
set<string>::iterator itt;
int main()
{
    while (~scanf("%d", &n))
    {
        SerToPath.clear();
        PathToSer.clear();
        //第一步：把字符串所对应的后缀全体插入这个字符串的set中
        for (int i = 1; i <= n; ++i)
        {
            scanf("%s", s);
            int l = strlen(s);
            int j; for (j = 7; j<l; ++j)if (s[j] == '/')break;//http://
            if (j == l) SerToPath[s].insert("^");
            else
            {
                s[j] = 0;
                SerToPath[s].insert(s + j + 1);
            }
            strcpy(a[i], s);
        }
        //第二步：把字符串对应的后缀集合的set插入字符串
        for (int i = 1; i <= n; ++i)
        {
            strcpy(s, a[i]);
            if (SerToPath.count(s))
            {
                PathToSer[SerToPath[s]].insert(s);
                SerToPath.erase(s);
            }
        }
        int ans= 0;
        for (it = PathToSer.begin(); it != PathToSer.end(); ++it)
        {
            //|| *it->first.begin() == ""
            //if (it->first.size() == 1 && (*it->first.begin() == "^" ))continue;
            if (it->second.size() > 1)++ans;
        }
        printf("%d\n", ans);
        for (it = PathToSer.begin(); it != PathToSer.end(); ++it)
        {
            //|| *it->first.begin() == ""
            //if (it->first.size() == 1 && (*it->first.begin() == "^"))continue;
            if (it->second.size() > 1)
            {
                for (itt = it->second.begin(); itt != it->second.end(); ++itt)
                {
                    cout << *itt << " ";
                }
                puts("");
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

map<string,vector<string> >mp;
map<vector<string>,vector<string> >ans;

int main()
{
    int n;scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        s=s.substr(7)+'/';
        int pos = s.find_first_of('/');
        mp[s.substr(0,pos)].push_back(s.substr(pos));
    }
    for(auto &p:mp)
    {
        sort(p.second.begin(),p.second.end());
        p.second.erase(unique(p.second.begin(),p.second.end()),p.second.end());
        ans[p.second].push_back(p.first);
    }
    int tot = 0;
    for(auto &p:ans)
        if(p.second.size()>1)
            tot++;
    printf("%d\n",tot);
    for(auto &p:ans)
    {
        if(p.second.size()>1)
        {
            for(auto &t:p.second)
                cout<<"http://"<<t<<" ";
            cout<<endl;
        }
    }
}


#include <cstdio>
#include <cstdlib>
#include <cstring>

int n;
char ad[100000][60];
int idx1[100000];
int nn;
char ad2[100000][60];
char host[100000][30];
char path[100000][30];
int hs[100000];
int n3;
int idx2[100000];
int ll[100000];
int k;
int hs2[100000];
int k2;
int ll2[100000];

int cmp1(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	return strcmp(ad[i1], ad[i2]);
}

int cmp2(const void *aa, const void *bb)
{
	int i;
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

int comp(int i1, int i2)
{
	int i;
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

void solve()
{
	int i, j;
	for(i=0; i<n; i++)
		idx1[i] = i;
	qsort(idx1, n , sizeof(int), cmp1);
	strcpy(ad2[0], ad[idx1[0]]);
	nn = 1;
	for(i=1; i<n; i++){
		if(strcmp(ad[idx1[i-1]], ad[idx1[i]]) != 0){
			strcpy(ad2[nn], ad[idx1[i]]);
			nn ++;
		}
	}
	for(i=0; i<nn; i++){
		char *p1 = strchr(ad2[i], '/');
		p1 += 2;
		char *p = strchr(p1, '/');
		if(p == 0){
			strcpy(host[i], p1);
			path[i][0] = '^';
			path[i][1] = 0;
			//path[i][0] = 0;
		}
		else{
			strncpy(host[i], p1, p-p1);
			host[i][p-p1] = 0;
			strcpy(path[i], p);
		}
	}
	n3 = 0;
	hs[n3] = 0;
	n3 ++;
	for(i=1; i<nn; i++){
		if(strcmp(host[i], host[i-1]) != 0){
			hs[n3] = i;
			n3 ++;
		}
	}
	for(i=0; i<n3-1; i++){
		ll[i] = hs[i+1] - hs[i];
	}
	ll[i] = nn - hs[i];
	for(i=0; i<n3; i++)
		idx2[i] = i;
	qsort(idx2, n3, sizeof(int), cmp2);//常用排序来寻找相同值，对所有host进行包括path的排序
	k2 = 0;
	hs2[k2] = 0;
	k2 ++;
	for(i=1; i<n3; i++){
		if(comp(idx2[i], idx2[i-1]) != 0){
			hs2[k2] = i;
			k2 ++;
		}
	}
	k = 0;
	for(i=0; i<k2-1; i++){
		ll2[i] = hs2[i+1] - hs2[i];
	}
	ll2[i] = n3 - hs2[i];
	for(i=0; i<k2; i++){
		if(ll2[i] > 1)
			k ++;
	}
	printf("%d\n", k);
	for(i=0; i<k2; i++){
		if(ll2[i] > 1){
			printf("http://%s", host[hs[idx2[hs2[i]]]]);//
			for(j=1; j<ll2[i]; j++){
				printf(" http://%s", host[hs[idx2[hs2[i]+j]]]);
			}
			printf("\n");
		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++)
		scanf("%s", &ad[i]);
	solve();
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>

int n;
char ad[100000][50];
int idx1[100000];
int nn;
char ad2[100000][50];
char host[100000][30];
char path[100000][30];
int hs[100000];
int n3;
int idx2[100000];
int ll[100000];
int k;
int hs2[100000];
int k2;
int ll2[100000];

int cmp1(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	return strcmp(ad[i1], ad[i2]);
}

int cmp2(const void *aa, const void *bb)
{
	int i;
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

int comp(int i1, int i2)
{
	int i;
	int l1 = ll[i1];
	int l2 = ll[i2];
	if(l1 > l2)
		return 1;
	else if(l1 < l2)
		return -1;
	else{
		for(i=0; i<l1; i++){
			int cm = strcmp(path[hs[i1]+i], path[hs[i2]+i]);
			if(cm != 0){
				return cm;
			}
		}
		return 0;
	}
}

void solve()
{
	int i, j;
	for(i=0; i<n; i++)
		idx1[i] = i;
	qsort(idx1, n , sizeof(int), cmp1);
	strcpy(ad2[0], ad[idx1[0]]);
	nn = 1;
	for(i=1; i<n; i++){
		if(strcmp(ad[idx1[i-1]], ad[idx1[i]]) != 0){
			strcpy(ad2[nn], ad[idx1[i]]);
			nn ++;
		}
	}
	for(i=0; i<nn; i++){
		char *p1 = strchr(ad2[i], '/');
		p1 += 2;
		char *p = strchr(p1, '/');
		if(p == 0){
			strcpy(host[i], p1);
			path[i][0] = 0;
		}
		else{
			strncpy(host[i], p1, p-p1);
			host[i][p-p1] = 0;
			strcpy(path[i], p);
		}
	}
	n3 = 0;
	hs[n3] = 0;
	n3 ++;
	for(i=1; i<nn; i++){
		if(strcmp(host[i], host[i-1]) != 0){
			hs[n3] = i;
			n3 ++;
		}
	}
	for(i=0; i<n3-1; i++){
		ll[i] = hs[i+1] - hs[i];
	}
	ll[i] = nn - hs[i];
	for(i=0; i<n3; i++)
		idx2[i] = i;
	qsort(idx2, n3, sizeof(int), cmp2);
	k2 = 0;
	hs2[k2] = 0;
	k2 ++;
	for(i=1; i<n3; i++){
		if(comp(idx2[i], idx2[i-1]) != 0){
			hs2[k2] = i;
			k2 ++;
		}
	}
	k = 0;
	for(i=0; i<k2-1; i++){
		ll2[i] = hs2[i+1] - hs2[i];
	}
	ll2[i] = n3 - hs2[i];
	for(i=0; i<k2; i++){
		if(ll2[i] > 1)
			k ++;
	}
	printf("%d\n", k);
	for(i=0; i<k2; i++){
		if(ll2[i] > 1){
			printf("http://%s", host[hs[idx2[hs2[i]]]]);
			for(j=1; j<ll2[i]; j++){
				printf(" http://%s", host[hs[idx2[hs2[i]+j]]]);
			}
			printf("\n");
		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++)
		scanf("%s", &ad[i]);
	solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcount(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> void setmin(T& a, T val) {if (a > val) a = val;}
template<class T> void setmax(T& a, T val) {if (a < val) a = val;}
void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

const int maxn = 100010;
int n;
string s[maxn];
map<string, int> tb;
map<string, int> mx[maxn];
map<map<string, int>, vi> my;

int query(string t) {
	if (tb.count(t)) return tb[t];
	int res = sz(tb);
	s[res] = t;
	return tb[t] = res;
}

void solve() {
	int n; cin>>n;
	FOR(i, 0, n) {
		string t; cin>>t;
		string hos = t, pat;
		FOR(j, 7, sz(t)) {
			if (t[j] == '/') {
				hos = t.substr(0, j);
				pat = t.substr(j);
				break;
			}
		}
		int k = query(hos);
		mx[k][pat];
	}
	FOR(i, 0, sz(tb)) {
		my[mx[i]].pb(i);
	}
	int cnt = 0;
	FORall(it, my) if (sz(it->se) > 1) cnt++;
	cout<<cnt<<"\n";
	FORall(it, my) {
		if (sz(it->se) > 1) {
			FOR(j, 0, sz(it->se)) {
				int k = it->se[j];
				cout<<s[k]<<" ";
			}
			cout<<"\n";
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
const int MOD = 1e9 + 7;
const ld E = 1e-10;
#define null NULL
#define y1 ybutnot1
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl "\n"
#endif
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".in"); _write(x ".out")
#define filesdatsol(x) _read(x ".dat"); _write(x ".sol")
#define output _write("output.txt")
#define input _read("input.txt")
#define mod % MOD
template<typename T> inline T sqr(T t) {
	return t * t;
}
#ifdef LOCAL
#define DEBUG
#endif

#ifdef DEBUG
#define dbg if(1)
#else
#define dbg if(0)
#endif

const int MAX = 7e5;
int ar[MAX][10], sz = 1;

inline void make(string a, string &b, string &c) {
	b = "";
	c = "";
	for (int i = 7; i < (int) a.size(); i++) {
		if (a[i] == '/') {
			b = a.substr(7, i - 7);
			c = a.substr(i, (int) a.size() - i);
			return;
		}
	}
	b = a.substr(7, (int) a.size() - 7);
}

struct lze_map {
	map<string, int> m;
	inline int get(string s) {
		if (m.find(s) == m.end()) {
			int ind = (int) m.size();
			m[s] = ind;
		}
		return m[s];
	}
};

vector<int> w;
int q;

inline void add(int &pos, int n) {
	for (int i = 0; i < 6; i++) {
		q = n % 10;
		if (ar[pos][q] == 0)
			ar[pos][q] = sz++;
		pos = ar[pos][q];
		n /= 10;
	}
}

void rand_test() {
	ofstream cout("input.txt");
	int n = 1e5;
	cout << n << endl;
	for (int i = 0; i < n; i++) {
		cout << "http://";
		for (int j = 0; j < 3; j++)
			cout << char('a');
		cout << "/";
		for (int j = 0; j < 1; j++)
			cout << char('a');
		cout << endl;
	}
	cout.close();
}

int main() {

	sync;
	cout.precision(12);
	cout << fixed;
	srand(time(NULL));

#ifdef LOCAL
	input;
#else

#endif

	ms(ar);

	int n;
	cin >> n;
	string s, s1, s2;
	lze_map m1, m2;
	vector<ii> vec;
	for(int i = 0; i < n; i++) {
		cin >> s;
		make(s, s1, s2);
		vec.push_back(make_pair(m1.get(s1), m2.get(s2)));

	}

	sort(vec.begin(), vec.end());

	vector<int> v;

	vector<ii> ans;

	for(int i = 0; i < (int) vec.size(); i++) {
		v.clear();
		v.push_back(vec[i].second);
		while(i + 1 < (int) vec.size() && vec[i].first == vec[i + 1].first) {
			i++;
			if(vec[i].second != v.back())
			v.push_back(vec[i].second);
		}
		int pos = 0;
		for(int j = 0; j < (int) v.size(); j++)
		add(pos, v[j]);
		ans.push_back(make_pair(pos, vec[i].first));
	}

	sort(ans.begin(), ans.end());

	string r[m1.m.size()];
	for(map<string, int>::iterator it = m1.m.begin(); it != m1.m.end(); it++)
	r[it->second] = it->first;
	v.clear();

	int an = 0;

	for(int i = 0; i < (int) ans.size(); i++) {
		v.clear();
		v.push_back(ans[i].second);
		while(i + 1 < (int) ans.size() && ans[i].first == ans[i + 1].first) {
			i++;
			v.push_back(ans[i].second);
		}
		if((int) v.size() > 1) {
			an++;
		}
	}

	cout << an << endl;

	for(int i = 0; i < (int) ans.size(); i++) {
		v.clear();
		v.push_back(ans[i].second);
		while(i + 1 < (int) ans.size() && ans[i].first == ans[i + 1].first) {
			i++;
			v.push_back(ans[i].second);
		}
		if((int) v.size() > 1) {
			an++;
			for(int i = 0; i < (int) v.size(); i++)
			cout << "http://" << r[v[i]] << " ";
			cout << endl;
		}
	}

}


// TEMPLATE {{{
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#define OJ 1
#else
#define OJ 0
#endif

#define endl '\n'
#define TIMESTAMP merr << "Execution time: " << (double)clock()/CLOCKS_PER_SEC << " s.\n"
class C_ {}; template <typename T> C_& operator <<(C_& __m, const T& __s) { if (!OJ) cerr << "\E[91m" << __s << "\E[0m"; return __m; }
C_ merr;

struct __s { __s() { if (OJ) { ios_base::Init i; cin.sync_with_stdio(0); cin.tie(0); } } ~__s(){ TIMESTAMP; } } __S;
/// END OF TEMPLATE }}}

map<string,int> mp;
string F[111111];
int mlen;
set<string> S[111111];

int getidx(const string& host) {
  if (mp.find(host) == mp.end()) {
    mp[host] = mlen++;
  }
  return mp[host];
}

struct indx {
  int cnt, len;
  int hash1, hash2;
  indx(int c, int l, int h1, int h2) {
    cnt = c, len = l, hash1 = h1, hash2 = h2;
  }
  bool operator<(const indx& o) const {
    return cnt < o.cnt || (cnt == o.cnt &&
          (len < o.len || (len == o.len &&
          (hash1 < o.hash1 || (hash1 == o.hash1 &&
           hash2 < o.hash2)))));
  }
};

long long mod1, mod2;
long long p1, p2;

bool isprime(int x) {
  for (int i = 2; i*i <= x; i++) {
    if (x%i == 0) return false;
  }
  return true;
}

void init() {
  vector<int> primes;
  int p = 1000010000 + rand()%10000;
  srand((int)time(0));
  while (primes.size() < 200) {
    if (isprime(p)) primes.push_back(p);
    p++;
  }
  mod1 = primes[rand()%primes.size()];
  mod2 = primes[rand()%primes.size()];
  p1 = 277 + rand()%1000;
  p2 = 278 + rand()%1000;
}

int hash1(const string& s) {
  long long h = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    h = (h*p1) % mod1;
    h = (h + (s[i]-41)) % mod1;
  }
  return (int)h;
}

int hash2(const string& s) {
  long long h = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    h = (h*p2) % mod2;
    h = (h + (s[i]-41)) % mod2;
  }
  return (int)h;
}

void add(const string& s) {
  string host;
  string addr;
  int cnt = 0;
  int i;
  for (i = 0; i < (int)s.size(); i++) {
    if (s[i] == '/') cnt++;
    if (cnt == 3) break;
    host += s[i];
  }
  for (; i < (int)s.size(); i++) {
    addr += s[i];
  }
  S[getidx(host)].insert(addr);
  F[getidx(host)] = host;
}

map<indx, vector<int> > R;

int main(void) {
  int n;
  init();
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    add(s);
  }
  for (int i = 0; i < mlen; i++) {
    int cnt = (int)S[i].size();
    string s;
    for (set<string>::const_iterator it = S[i].begin(); it != S[i].end(); ++it) {
      s += *it;
      s += ';';
    }
    indx idx(cnt, (int)s.size(), hash1(s), hash2(s));
    R[idx].push_back(i);
  }
  vector<string> RR;
  for (map<indx, vector<int> >::const_iterator it = R.begin(); it != R.end(); ++it) {
    const vector<int>& V = it->second;
    if (V.size() < 2) continue;
    string s;
    for (int i = 0; i < (int)V.size(); i++) {
      s += F[V[i]];
      s += ' ';
    }
    RR.push_back(s);
  }
  cout << RR.size() << endl;
  for (int i = 0; i < (int)RR.size(); i++) {
    cout << RR[i] << endl;
  }
  return 0;
}


#include "iostream"
#include "cstdio"
#include "map"
#include "cstring"
#include "algorithm"
#include "vector"
#include "cassert"
#include "map"
#include "string"
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
#define maxn 100005

int n;
map<string, int> mid, pid;
std::vector<string> hostname;
vector<int> a[100000];
char s[1000];
int m_total = 0, p_total = 0;
int b[100000];
std::vector<std::vector<int> > ans;

bool cmp(int i, int j){
	return a[i] < a[j];
}

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", s);
		int j=7;
		for(; s[j]; ++j) if(s[j]=='/') break;
		string host = "", path = "";
		for(int k=0; k<j; ++k) host += s[k];
		for(int k=j; s[k]; ++k) path += s[k];
		if(mid.count(host)==0){
			mid[host] = m_total++;
			hostname.push_back(host);
		}
		if(pid.count(path)==0){
			pid[path] = p_total++;
		}
		a[mid[host]].push_back(pid[path]);
		cout << host << " " << path << endl;
	}
	rep(i, m_total){
		sort(a[i].begin(),a[i].end());
		a[i].erase(unique(a[i].begin(), a[i].end()), a[i].end());
		b[i] = i;
	}

	sort(b, b + m_total, cmp);
	int l=0;
	for(int i=1; i<m_total; ++i){
		if(a[b[i]]!=a[b[l]]){
			if(i-l > 1){
				std::vector<int> v;
				v.clear();
				for(int j=l; j<i; ++j) v.push_back(b[j]);
				ans.push_back(v);
			}
			l = i;
		}
	}

	printf("%d\n", ans.size());
	for(int i=0; i<ans.size(); ++i){
		rep(j, ans[i].size()){
			printf("%s%c", hostname[ans[i][j]].c_str(), j < ans[i].size()-1? ' ':'\n');
		}
	}
	return 0;
}


#include "iostream"
#include "cstdio"
#include "map"
#include "cstring"
#include "algorithm"
#include "vector"
#include "cassert"
#include "map"
#include "string"
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
#define maxn 100005

int n;
map<string, int> mid, pid;
std::vector<string> hostname;
vector<int> a[100000];
char s[1000];
int m_total = 0, p_total = 0;
int b[100000];
std::vector<std::vector<int> > ans;

bool cmp(int i, int j){
	return a[i] < a[j];
}

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", s);
		int j=7;
		for(; s[j]; ++j) if(s[j]=='/') break;
		string host = "", path = "";
		for(int k=0; k<j; ++k) host += s[k];
		for(int k=j; s[k]; ++k) path += s[k];
		if(mid.count(host)==0){
			mid[host] = m_total++;
			hostname.push_back(host);
		}
		if(pid.count(path)==0){
			pid[path] = p_total++;
		}
		a[mid[host]].push_back(pid[path]);
		// cout << host << " " << path << endl;
	}
	rep(i, m_total){
		sort(a[i].begin(),a[i].end());
		a[i].erase(unique(a[i].begin(), a[i].end()), a[i].end());
		b[i] = i;
	}

	sort(b, b + m_total, cmp);
	int l=0;
	for(int i=1; i<m_total; ++i){
		if(a[b[i]]!=a[b[l]]){
			if(i-l > 1){
				std::vector<int> v;
				v.clear();
				for(int j=l; j<i; ++j) v.push_back(b[j]);
				ans.push_back(v);
			}
			l = i;
		}
	}

	if(m_total - l > 1){
		std::vector<int> v;
		v.clear();
		for(int j=l; j<m_total; ++j) v.push_back(b[j]);
		ans.push_back(v);
	}

	printf("%d\n", ans.size());
	for(int i=0; i<ans.size(); ++i){
		rep(j, ans[i].size()){
			printf("%s%c", hostname[ans[i][j]].c_str(), j < ans[i].size()-1? ' ':'\n');
		}
	}
	return 0;
}


#include "iostream"
#include "cstdio"
#include "map"
#include "cstring"
#include "algorithm"
#include "vector"
#include "cassert"
#include "map"
#include "string"
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)
#define maxn 100005

int n;
map<string, int> mid, pid;
std::vector<string> hostname;
vector<int> a[100000];
char s[1000];
int m_total = 0, p_total = 0;
int b[100000];
std::vector<std::vector<int> > ans;

bool cmp(int i, int j){
	return a[i] < a[j];
}

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", s);
		int j=7;
		for(; s[j]; ++j) if(s[j]=='/') break;
		string host = "", path = "";
		for(int k=0; k<j; ++k) host += s[k];
		for(int k=j; s[k]; ++k) path += s[k];
		if(mid.count(host)==0){
			mid[host] = m_total++;
			hostname.push_back(host);
		}
		if(pid.count(path)==0){
			pid[path] = p_total++;
		}
		a[mid[host]].push_back(pid[path]);
		// cout << host << " " << path << endl;
	}
	rep(i, m_total){
		sort(a[i].begin(),a[i].end());
		a[i].erase(unique(a[i].begin(), a[i].end()), a[i].end());
		b[i] = i;
	}

	sort(b, b + m_total, cmp);
	int l=0;
	for(int i=1; i<m_total; ++i){
		if(a[b[i]]!=a[b[l]]){
			if(i-l > 1){
				std::vector<int> v;
				v.clear();
				for(int j=l; j<i; ++j) v.push_back(b[j]);
				ans.push_back(v);
			}
			l = i;
		}
	}

	printf("%d\n", ans.size());
	for(int i=0; i<ans.size(); ++i){
		rep(j, ans[i].size()){
			printf("%s%c", hostname[ans[i][j]].c_str(), j < ans[i].size()-1? ' ':'\n');
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define INF 1000000007
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define VI vector<int>
const double EPS = 1e-7, PI = acos(-1.0);
using namespace std;
typedef long long LL;
typedef pair <LL, LL> P;
const int NUM = 100010;
int n;
char s[100];
map<string, set<string> > mp;
map<string, set<string> > ::iterator it;
map<P, vector<string> >ans;
map<P, vector<string> >::iterator kt;
LL mod1 = 1e9 + 7, mod2 = 1e9 + 9, B = 131;

int main()
{
#ifdef ACM_TEST
    freopen("in.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for(int i = 0; i < n; ++i)
    {
        scanf(" http://%s", s);
        char *pch = strchr(s, '/');
        if(pch != NULL)
        {
            string hostname = string(s, pch - s);
            string path = pch;
            mp[hostname].insert(path);
        }
        else
        {
            mp[string(s)].insert("");
        }
    }
    for(it = mp.begin(); it != mp.end(); ++it)
    {
        LL h1 = 0, h2 = 0;
        for(set<string>::iterator jt = it->second.begin(); jt != it->second.end(); ++jt)
        {
            string tmp = *jt;
            for(int i = 0; i < (int)tmp.length(); ++i)
            {
                h1 = (h1 * B + tmp[i]) % mod1;
                h2 = (h2 * B + tmp[i]) % mod2;
            }
            h1 = (h1 * B + '$') % mod1;
            h2 = (h2 * B + '$') % mod2;
        }
        ans[P(h1, h2)].push_back(it->first);
    }
    int res = 0;
    P zero = P((LL)'$', (LL)'$');
    for(kt = ans.begin(); kt != ans.end(); ++kt)
        if((int)kt->second.size() > 1 && kt->first != zero)
            ++res;
    printf("%d\n", res);
    for(kt = ans.begin(); kt != ans.end(); ++kt)
        if((int)kt->second.size() > 1 && kt->first != zero)
        {
            for(vector<string>::iterator jt = kt->second.begin(); jt != kt->second.end();)
            {
                printf("http://%s", jt->data());
                ++jt;
                if(jt == kt->second.end())
                {
                    printf("\n");
                    break;
                }
                else
                    printf(" ");
            }
        }
    return 0;
}


#include <bits/stdc++.h>
#define INF 1000000007
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define VI vector<int>
const double EPS = 1e-7, PI = acos(-1.0);
using namespace std;
typedef long long LL;
typedef pair <LL, LL> P;
const int NUM = 100010;
int n;
char s[100];
map<string, set<string> > mp;
map<string, set<string> > ::iterator it;
map<P, vector<string> >ans;
map<P, vector<string> >::iterator kt;
LL mod1 = 1e9 + 7, mod2 = 1e9 + 9, B = 131;

int main()
{
#ifdef ACM_TEST
    freopen("in.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for(int i = 0; i < n; ++i)
    {
        scanf(" http://%s", s);
        char *pch = strchr(s, '/');
        if(pch != NULL)
        {
            string hostname = string(s, pch - s);
            string path = pch;
            mp[hostname].insert(path);
        }
        else
        {
            mp[string(s)].insert("");
        }
    }
    for(it = mp.begin(); it != mp.end(); ++it)
    {
        LL h1 = 0, h2 = 0;
        for(set<string>::iterator jt = it->second.begin(); jt != it->second.end(); ++jt)
        {
            string tmp = *jt;
            for(int i = 0; i < (int)tmp.length(); ++i)
            {
                h1 = (h1 * B + tmp[i]) % mod1;
                h2 = (h2 * B + tmp[i]) % mod2;
            }
            h1 = (h1 * B + '$') % mod1;
            h2 = (h2 * B + '$') % mod2;
        }
        ans[P(h1, h2)].push_back(it->first);
    }
    int res = 0;
    for(kt = ans.begin(); kt != ans.end(); ++kt)
        if((int)kt->second.size() > 1)
            ++res;
    printf("%d\n", res);
    for(kt = ans.begin(); kt != ans.end(); ++kt)
        if((int)kt->second.size() > 1)
        {
            for(vector<string>::iterator jt = kt->second.begin(); jt != kt->second.end();)
            {
                printf("http://%s", jt->data());
                ++jt;
                if(jt == kt->second.end())
                {
                    printf("\n");
                    break;
                }
                else
                    printf(" ");
            }
        }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define orta (bas + son >> 1)
#define sag (k + k + 1)
#define sol (k + k)
#define endl '\n'
#define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++)
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)
#define mp make_pair
#define nd second
#define st first
#define type(x) __typeof(x.begin())

typedef pair < int ,int > pii;

typedef long long ll;

const long long linf = 1e18+5;
const int mod1 = (int) 1e9 + 7;
const int mod2 = (int) 1e9 + 9;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;

int n, S;
map< pii , int > H, ww;
vector< pii > v[N], all;
string str, ss[N];
map< pii , vector< int > > araba;
char s[N];

void insert_somehow(string &str) {
	int t = str.size() - 1;
	int t1 = 0, t2 = 0;
	int t3 = 1, t4 = 1;
	int c = 0;
	FOR(i, 0, t) {
		c += str[i] == '/';
		if(c == 3) {
			FOR(j, i, t) {
				t3 = (t3 * 911LL + str[i]) % mod1;
				t4 = (t4 * 1453LL + str[i]) % mod2;
			}
			break;
		}
		t1 = (t1 * 911LL + str[i]) % mod1;
		t2 = (t2 * 1453LL + str[i]) % mod2;
	}
	if(!H[mp(t1, t2)]) {
		H[mp(t1, t2)] = ++S;
		c = 0;
		FOR(i, 0, t) {
			c += str[i] == '/';
			if(c == 3) break;
			ss[S] += str[i];
		}
	}
	int w = H[mp(t1, t2)];
	v[w].pb(mp(t3, t4));
	all.pb(mp(t3, t4));
}

int main() {

	scanf("%d", &n);

	FOR(i, 1, n) {
		scanf("%s", s);
		str = s;
		insert_somehow(str);
	}

	sort(all.begin(), all.end());
	all.resize(unique(all.begin(), all.end()) - all.begin());
	int s = 0;
	foreach(it, all) ww[*it] = ++s;

	FOR(i, 1, S) {
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		ll t1 = 0, t2 = 0;
		foreach(it, v[i]) {
			int t = ww[*it];
			t1 = (t1 * 15485863LL + t) % mod1;
			t2 = (t2 * 32452843LL + t) % mod2;
		}
		araba[mp(t1, t2)].pb(i);
	}

	int ans = 0;

	foreach(it, araba) ans += it->nd.size() != 1;

	cout << ans << endl;

	foreach(it, araba) {
		if(it->nd.size() == 1) continue;
		foreach(it2, it->nd) {
			int t = *it2;
			FOR(i, 0, ss[t].size() - 1)
				printf("%c", ss[t][i]);
			printf(" ");
		}
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define orta (bas + son >> 1)
#define sag (k + k + 1)
#define sol (k + k)
#define endl '\n'
#define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++)
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)
#define mp make_pair
#define nd second
#define st first
#define type(x) __typeof(x.begin())

typedef pair < int ,int > pii;

typedef long long ll;

const long long linf = 1e18+5;
const int mod1 = (int) 1e9 + 7;
const int mod2 = (int) 1e9 + 9;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;

int n, S;
map< pii , int > H, ww;
vector< pii > v[N], all;
string str, ss[N];
map< pii , vector< int > > araba;
char s[N];

void insert_somehow(string &str) {
	int t = str.size() - 1;
	int t1 = 0, t2 = 0;
	int t3 = 1, t4 = 1;
	int c = 0;
	FOR(i, 0, t) {
		c += str[i] == '/';
		if(c == 3) {
			FOR(j, i, t) {
				t3 = (t3 * 911LL + str[j]) % mod1;
				t4 = (t4 * 1453LL + str[j]) % mod2;
			}
			break;
		}
		t1 = (t1 * 911LL + str[i]) % mod1;
		t2 = (t2 * 1453LL + str[i]) % mod2;
	}
	if(!H[mp(t1, t2)]) {
		H[mp(t1, t2)] = ++S;
		c = 0;
		FOR(i, 0, t) {
			c += str[i] == '/';
			if(c == 3) break;
			ss[S] += str[i];
		}
	}
	int w = H[mp(t1, t2)];
	v[w].pb(mp(t3, t4));
	all.pb(mp(t3, t4));
}

int main() {

	scanf("%d", &n);

	FOR(i, 1, n) {
		scanf("%s", s);
		str = s;
		insert_somehow(str);
	}

	sort(all.begin(), all.end());
	all.resize(unique(all.begin(), all.end()) - all.begin());
	int s = 0;
	foreach(it, all) ww[*it] = ++s;

	FOR(i, 1, S) {
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		ll t1 = 0, t2 = 0;
		foreach(it, v[i]) {
			int t = ww[*it];
			t1 = (t1 * 15485863LL + t) % mod1;
			t2 = (t2 * 32452843LL + t) % mod2;
		}
		araba[mp(t1, t2)].pb(i);
	}

	int ans = 0;

	foreach(it, araba) ans += it->nd.size() != 1;

	cout << ans << endl;

	foreach(it, araba) {
		if(it->nd.size() == 1) continue;
		foreach(it2, it->nd) {
			int t = *it2;
			FOR(i, 0, ss[t].size() - 1)
				printf("%c", ss[t][i]);
			printf(" ");
		}
		cout << endl;
	}

	return 0;
}


#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
#define X    first
#define Y    second
//作者:中国江苏南京丁天行
//from CrAzYUnIoN
//I prefer being hacked than being FST
using namespace std;
int n,k;
string s,q;
pair<pair<ll,ll>,pair<ll,ll> > ha[100005];
string qwe[100005];
map<string,int> m;
pair<pair<pair<ll,ll>,pair<ll,ll> >,int> l[100005];
int ans;
set<pair<pair<ll,ll>,pair<ll,ll> > >ss[100005];
vector<pair<pair<ll,ll>,pair<ll,ll> > >vs[100005];
vector<int> res[100005];
ll cty(int w){
           ll t=12327+4293*w,ans=0;
           for(int i=0;i<q.size();i++)ans=ans*t+q[i];
}
int get(){
    if(m.count(s)) return m[s];
    m[s]=++k;
    qwe[k]=s;
    return k;
}
pair<pair<ll,ll>,pair<ll,ll> > dtx(pair<pair<ll,ll>,pair<ll,ll> > q,pair<pair<ll,ll>,pair<ll,ll> > w){
                             q.X.X=q.X.X*orz+w.X.X;
                             q.X.Y=q.X.Y*orz+w.X.Y;
                             q.Y.X=q.Y.X*orz+w.Y.X;
                             q.Y.Y=q.Y.Y*orz+w.Y.Y;
                             return q;
}

int main()
{
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++){
            string p;
            cin>>p;
            s="";
            q="";
            int b=0;
            for(int i=0;i<p.size();i++){
                    if(p[i]=='/')b++;
                    if(b>2)q+=p[i];
                    else s+=p[i];
            }
            int z=get();
            pair<pair<ll,ll>,pair<ll,ll> >pl=mp(mp(cty(1),cty(2)),mp(cty(3),cty(4)));
            if(!ss[z].count(pl))ss[z].insert(pl),vs[z].pb(pl);
    }
    for(int i=1;i<=k;i++)sort(vs[i].begin(),vs[i].end());
    for(int i=1;i<=k;i++)for(int j=0;j<vs[i].size();j++)ha[i]=dtx(ha[i],vs[i][j]);
    for(int i=1;i<=k;i++)l[i]=mp(ha[i],i);
    sort(l+1,l+k+1);
    for(int i=1;i<=k;i++){
            int j=i;
            while(l[j+1].first==l[j].first&&j!=k)j++;
            if(i!=j){
                     ans++;
                     for(int v=i;v<=j;v++)res[ans].pb(l[v].second);
            }
            i=j;
    }
    cout<<ans<<endl;
    for(int i=1;i<=ans;i++){
            int o=res[i].size();
            for(int j=0;j<o-1;j++)cout<<qwe[res[i][j]]<<' ';
            cout<<qwe[res[i][o-1]]<<'\n';
    }
	//system("pause");
	return 0;
}


#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
#define X    first
#define Y    second
//作者:中国江苏南京丁天行
//from CrAzYUnIoN
//I prefer being hacked than being FST
using namespace std;
int n,k;
string s,q;
pair<pair<ll,ll>,pair<ll,ll> > ha[100005];
string qwe[100005];
map<string,int> m;
pair<pair<pair<ll,ll>,pair<ll,ll> >,int> l[100005];
int ans;
set<pair<pair<ll,ll>,pair<ll,ll> > >ss[100005];
vector<pair<pair<ll,ll>,pair<ll,ll> > >vs[100005];
vector<int> res[100005];
ll cty(int w){
           ll t=12327+4293*w,ans=0;
           for(int i=0;i<q.size();i++)ans=ans*t+q[i]+23;
           return ans;
}
int get(){
    if(m.count(s)) return m[s];
    m[s]=++k;
    qwe[k]=s;
    return k;
}
pair<pair<ll,ll>,pair<ll,ll> > dtx(pair<pair<ll,ll>,pair<ll,ll> > q,pair<pair<ll,ll>,pair<ll,ll> > w){
                             q.X.X=q.X.X*orz+w.X.X;
                             q.X.Y=q.X.Y*orz+w.X.Y;
                             q.Y.X=q.Y.X*orz+w.Y.X;
                             q.Y.Y=q.Y.Y*orz+w.Y.Y;
                             return q;
}

int main()
{
    //freopen("out.out","w",stdout);
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++){
            string p;
            cin>>p;
            s="";
            q="";
            int b=0;
            for(int i=0;i<p.size();i++){
                    if(p[i]=='/')b++;
                    if(b>2)q+=p[i];
                    else s+=p[i];
            }
            int z=get();
            pair<pair<ll,ll>,pair<ll,ll> >pl=mp(mp(cty(1),cty(2)),mp(cty(3),cty(4)));
            if(b==2)pl=mp(mp(-12321,-15465),mp(-14545,-10111));
            //cout<<s<<':'<<q<<':'<<z<<endl<<pl.X.X<<endl;

            if(!ss[z].count(pl))ss[z].insert(pl),vs[z].pb(pl);
    }
    for(int i=1;i<=k;i++)sort(vs[i].begin(),vs[i].end());
    for(int i=1;i<=k;i++)for(int j=0;j<vs[i].size();j++)ha[i]=dtx(ha[i],vs[i][j]);
    for(int i=1;i<=k;i++)l[i]=mp(ha[i],i);
    sort(l+1,l+k+1);
    for(int i=1;i<=k;i++){
            int j=i;
            while(l[j+1].first==l[j].first&&j!=k)j++;
            if(i!=j){
                     ans++;
                     for(int v=i;v<=j;v++)res[ans].pb(l[v].second);
            }
            i=j;
    }
    cout<<ans<<endl;
    for(int i=1;i<=ans;i++){
            int o=res[i].size();
            for(int j=0;j<o-1;j++)cout<<qwe[res[i][j]]<<' ';
            cout<<qwe[res[i][o-1]]<<'\n';
    }/*
	cout<<"asdfghjkl;"<<endl;
	for(int i=1;i<=k;i++){
            cout<<"{"<<endl;
            cout<<qwe[i]<<endl;
            for(int j=0;j<vs[i].size();j++)cout<<vs[i][j].X.X<<':';
            cout<<endl;
            cout<<'}'<<endl;
    }
	//system("pause");
	*/
	return 0;
}


#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
#define X    first
#define Y    second
//作者:中国江苏南京丁天行
//from CrAzYUnIoN
//I prefer being hacked than being FST
using namespace std;
int n,k;
string s,q;
pair<pair<ll,ll>,pair<ll,ll> > ha[100005];
string qwe[100005];
map<string,int> m;
pair<pair<pair<ll,ll>,pair<ll,ll> >,int> l[100005];
int ans;
set<pair<pair<ll,ll>,pair<ll,ll> > >ss[100005];
vector<pair<pair<ll,ll>,pair<ll,ll> > >vs[100005];
vector<int> res[100005];
ll cty(int w){
           ll t=12327+4293*w,ans=0;
           for(int i=0;i<q.size();i++)ans=ans*t+q[i];
}
int get(){
    if(m.count(s)) return m[s];
    m[s]=++k;
    qwe[k]=s;
    return k;
}
pair<pair<ll,ll>,pair<ll,ll> > dtx(pair<pair<ll,ll>,pair<ll,ll> > q,pair<pair<ll,ll>,pair<ll,ll> > w){
                             q.X.X=q.X.X*orz+w.X.X;
                             q.X.Y=q.X.Y*orz+w.X.Y;
                             q.Y.X=q.Y.X*orz+w.Y.X;
                             q.Y.Y=q.Y.Y*orz+w.Y.Y;
                             return q;
}

int main()
{
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++){
            string p;
            cin>>p;
            s="";
            q="";
            int b=0;
            for(int i=0;i<p.size();i++){
                    if(p[i]=='/')b++;
                    if(b>2)q+=p[i];
                    else s+=p[i];
            }
            int z=get();
            pair<pair<ll,ll>,pair<ll,ll> >pl=mp(mp(cty(1),cty(2)),mp(cty(3),cty(4)));
            if(b==2)pl=mp(mp(-1,-1),mp(-1,-1));
            if(!ss[z].count(pl))ss[z].insert(pl),vs[z].pb(pl);
    }
    for(int i=1;i<=k;i++)sort(vs[i].begin(),vs[i].end());
    for(int i=1;i<=k;i++)for(int j=0;j<vs[i].size();j++)ha[i]=dtx(ha[i],vs[i][j]);
    for(int i=1;i<=k;i++)l[i]=mp(ha[i],i);
    sort(l+1,l+k+1);
    for(int i=1;i<=k;i++){
            int j=i;
            while(l[j+1].first==l[j].first&&j!=k)j++;
            if(i!=j){
                     ans++;
                     for(int v=i;v<=j;v++)res[ans].pb(l[v].second);
            }
            i=j;
    }
    cout<<ans<<endl;
    for(int i=1;i<=ans;i++){
            int o=res[i].size();
            for(int j=0;j<o-1;j++)cout<<qwe[res[i][j]]<<' ';
            cout<<qwe[res[i][o-1]]<<'\n';
    }
	//system("pause");
	return 0;
}


#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <time.h>
#pragma warning (disable : 4996)

using namespace std;

#define MP make_pair
#define lli long long int

const int N = 1e6 + 20;
const lli M = 1e9 + 7;

map<set<string>, vector<string> > answer;
map<string, set<string> > paths;

int main() {
	ios_base::sync_with_stdio(0);
#ifdef FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		int p = 7;
		while (p < s.length() && s[p] != '/') ++p;
		string path = "";
		if (p == s.length()) path = "NO WAY";
		else if (p + 1 < s.length()) path = s.substr(p + 1);
		paths[s.substr(0, p)].insert(path);
	}
	int k = 0;
	for (map<string, set<string> >::iterator it = paths.begin(); it != paths.end(); ++it) {
		answer[it->second].push_back(it->first);
		k += answer[it->second].size() == 2;
	}
	cout << k << endl;
	for (map<set<string>, vector<string> >::iterator it = answer.begin(); it != answer.end(); ++it) {
		if (it->second.size() > 1) {
			for (int i = 0; i < it->second.size(); ++i) cout << it->second[i] << ' ';
			cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <time.h>
#pragma warning (disable : 4996)

using namespace std;

#define MP make_pair
#define lli long long int

const int N = 1e6 + 20;
const lli M = 1e9 + 7;

map<set<string>, vector<string> > answer;
map<string, set<string> > paths;

int main() {
	ios_base::sync_with_stdio(0);
#ifdef FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		int p = 7;
		while (p < s.length() && s[p] != '/') ++p;
		string path = "";
		if (p == s.length()) continue;
		if (p + 1 < s.length()) path = s.substr(p + 1);
		paths[s.substr(0, p)].insert(path);
	}
	int k = 0;
	for (map<string, set<string> >::iterator it = paths.begin(); it != paths.end(); ++it) {
		answer[it->second].push_back(it->first);
		k += answer[it->second].size() == 2;
	}
	cout << k << endl;
	for (map<set<string>, vector<string> >::iterator it = answer.begin(); it != answer.end(); ++it) {
		if (it->second.size() > 1) {
			for (int i = 0; i < it->second.size(); ++i) cout << it->second[i] << ' ';
			cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#define ll long long
#define pb push_back
#define mp make_pair
#define M_PI 3.14159265358979323846
using namespace std;
int main() {
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    int n;
	cin >> n;
	map <string, set <string> > s;
	for (int i = 0; i < n; i++) {
		string t;
		cin >> t;
		for (int j = 7; j < t.size(); j++) {
			if (t[j] == '/') {
				string u = t.substr(0, j);
				string v = t.substr(j, t.size() - j);
				if (s.find(u) == s.end()) {
					set <string> w;
					w.insert(v);
					s.insert(mp(u, w));
				}
				else {
					if (s[u].find(v) == s[u].end()) s[u].insert(v);
				}
				break;
			}
			if (j == t.size() - 1) {
				if (s.find(t) == s.end()) {
					set <string> w;
					w.insert("");
					s.insert(mp(t, w));
				}
				else {
					if (s[t].find("") == s[t].end()) s[t].insert("");
				}
				break;
			}
		}
	}
	map <set <string>, set <string> > b;
	while (s.size() > 0) {
		string t = (*(s.begin())).first;
		set <string> a = s[t];
		s.erase(t);
		if (b.find(a) != b.end()) b[a].insert(t);
		else {
			set <string> v;
			v.insert(t);
			b.insert(mp(a, v));
		}
	}
	vector <vector <string> > ans;
	while (b.size() > 0) {
		set <string> u = (*(b.begin())).first;
		set <string> v = b[u];
		b.erase(u);
		if (v.size() > 1) {
			vector <string> c;
			while (v.size() > 0) {
				string t = *(v.begin());
				c.pb(t);
				v.erase(t);
			}
			ans.pb(c);
		}
	}
	cout << ans.size() << "\n";
	for (int i = 0; i < ans.size(); i++) {
		for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
		cout << "\n";
	}
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e4 + 100;
int n, cnt, pos, tt;
string s, pre, str[MAX];
map <string, int> mp;
vector <int> res[MAX];

typedef pair <int, set <string> > pis;
pis data[MAX];

bool cmp(const pis& x, const pis& y){
	return x.second < y.second;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	while (n--){
		cin >> s;
		s.erase(0, 7);
		if ((pos = s.find('/')) == -1){
			pre = s;
			s = "";
		}
		else{
			pre = s.substr(0, pos);
			s.erase(0, pos);
		}

		if (mp.find(pre) == mp.end())
			str[tt = mp[pre] = ++cnt] = pre;
		else
			tt = mp[pre];

		data[tt].second.insert(s);
	}

	for (int i = 1; i <= cnt; ++i)
		data[i].first = i;
	res[n = 1].push_back(data[1].first);
	sort(data + 1, data + 1 + cnt, cmp);
	for (int i = 2; i <= cnt; ++i){
		if (data[i].second != data[i - 1].second)
			++n;
		res[n].push_back(data[i].first);
	}

	cnt = 0;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		bool check = true;
		for (int j = 0; j < res[i].size(); ++j)
		if (!(data[res[i][j]].second.size() == 1 && *data[res[i][j]].second.begin() == "")){
			check = false;
			break;
		}
		cnt += !check;
	}

	cout << cnt << endl;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		bool check = true;
		for (int j = 0; j < res[i].size(); ++j)
		if (!(data[res[i][j]].second.size() == 1 && *data[res[i][j]].second.begin() == "")){
			check = false;
			break;
		}
		if (check)
			continue;
		for (int j = 0; j < res[i].size(); ++j)
			cout << "http://" + str[res[i][j]] << ' ';
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e5 + 100;
int n, cnt, pos, tt;
string s, pre, str[MAX];
map <string, int> mp;
vector <int> res[MAX];

typedef pair <int, set <string> > pis;
pis data[MAX];

bool cmp(const pis& x, const pis& y){
	return x.second < y.second;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	while (n--){
		cin >> s;
		s.erase(0, 7);
		if ((pos = s.find('/')) == -1){
			pre = s;
			s = "";
		}
		else{
			pre = s.substr(0, pos);
			s.erase(0, pos);
		}

		if (mp.find(pre) == mp.end())
			str[tt = mp[pre] = ++cnt] = pre;
		else
			tt = mp[pre];

		data[tt].second.insert(s);
	}

	for (int i = 1; i <= cnt; ++i)
		data[i].first = i;

	sort(data + 1, data + 1 + cnt, cmp);
	res[n = 1].push_back(data[1].first);
	for (int i = 2; i <= cnt; ++i){
		if (data[i].second != data[i - 1].second)
			++n;
		res[n].push_back(data[i].first);
	}

	cnt = 0;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1)
		++cnt;

	cout << cnt << endl;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		for (int j = 0; j < res[i].size(); ++j)
			cout << "http://" + str[res[i][j]] << ' ';
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e5 + 100;
int n, cnt, pos, tt;
string s, pre, str[MAX];
map <string, int> mp;
vector <int> res[MAX];

typedef pair <int, set <string> > pis;
pis data[MAX];

bool cmp(const pis& x, const pis& y){
	return x.second < y.second;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	while (n--){
		cin >> s;
		s.erase(0, 7);
		if ((pos = s.find('/')) == -1)
			continue;

		pre = s.substr(0, pos);
		s.erase(0, pos);
		if (mp.find(pre) == mp.end())
			str[tt = mp[pre] = ++cnt] = pre;
		else
			tt = mp[pre];

		data[tt].second.insert(s);
	}

	for (int i = 1; i <= cnt; ++i)
		data[i].first = i;
	res[n = 1].push_back(data[1].first);
	sort(data + 1, data + 1 + cnt, cmp);
	for (int i = 2; i <= cnt; ++i){
		if (data[i].second != data[i - 1].second)
			++n;
		res[n].push_back(data[i].first);
	}

	cnt = 0;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1)
		++cnt;

	cout << cnt << endl;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		for (int j = 0; j < res[i].size(); ++j)
			cout << "http://" + str[res[i][j]] << ' ';
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e5 + 100;
int n, cnt, pos, tt;
string s, pre, str[MAX];
map <string, int> mp;
vector <int> res[MAX];

typedef pair <int, set <string> > pis;
pis data[MAX];

bool cmp(const pis& x, const pis& y){
	return x.second < y.second;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	while (n--){
		cin >> s;
		s.erase(0, 7);
		if ((pos = s.find('/')) == -1){
			pre = s;
			s = "";
		}
		else{
			pre = s.substr(0, pos);
			s.erase(0, pos);
		}

		if (mp.find(pre) == mp.end())
			str[tt = mp[pre] = ++cnt] = pre;
		else
			tt = mp[pre];

		data[tt].second.insert(s);
	}

	for (int i = 1; i <= cnt; ++i)
		data[i].first = i;
	res[n = 1].push_back(data[1].first);
	sort(data + 1, data + 1 + cnt, cmp);
	for (int i = 2; i <= cnt; ++i){
		if (data[i].second != data[i - 1].second)
			++n;
		res[n].push_back(data[i].first);
	}

	cnt = 0;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1)
		++cnt;

	cout << cnt << endl;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		for (int j = 0; j < res[i].size(); ++j)
			cout << "http://" + str[res[i][j]] << ' ';
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e5 + 100;
int n, cnt, pos, tt;
string s, pre, str[MAX];
map <string, int> mp;
vector <int> res[MAX];

typedef pair <int, set <string> > pis;
pis data[MAX];

bool cmp(const pis& x, const pis& y){
	return x.second < y.second;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	while (n--){
		cin >> s;
		s.erase(0, 7);
		if ((pos = s.find('/')) == -1){
			pre = s;
			s = "";
		}
		else{
			pre = s.substr(0, pos);
			s.erase(0, pos);
		}

		if (mp.find(pre) == mp.end())
			str[tt = mp[pre] = ++cnt] = pre;
		else
			tt = mp[pre];

		data[tt].second.insert(s);
	}

	for (int i = 1; i <= cnt; ++i)
		data[i].first = i;
	res[n = 1].push_back(data[1].first);
	sort(data + 1, data + 1 + cnt, cmp);
	for (int i = 2; i <= cnt; ++i){
		if (data[i].second != data[i - 1].second)
			++n;
		res[n].push_back(data[i].first);
	}

	cnt = 0;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		bool check = true;
		for (int j = 0; j < res[i].size(); ++j)
		if (!(data[res[i][j]].second.size() == 1 && *data[res[i][j]].second.begin() == "")){
			check = false;
			break;
		}
		cnt += !check;
	}

	cout << cnt << endl;
	for (int i = 1; i <= n; ++i)
	if (res[i].size() > 1){
		bool check = true;
		for (int j = 0; j < res[i].size(); ++j)
		if (!(data[res[i][j]].second.size() == 1 && *data[res[i][j]].second.begin() == "")){
			check = false;
			break;
		}
		if (check)
			continue;
		for (int j = 0; j < res[i].size(); ++j)
			cout << "http://" + str[res[i][j]] << ' ';
		cout << endl;
	}

	return 0;
}